[PATCH] [SRU][TRUSTY] Btrfs: clear compress-force when remounting with compress option

Colin Ian King colin.king at canonical.com
Fri Mar 20 10:18:21 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 20/03/15 08:03, Stefan Bader wrote:
> On 19.03.2015 18:37, Colin King wrote:
>> From: Colin Ian King <colin.king at canonical.com>
>>
>> BugLink: http://bugs.launchpad.net/bugs/1434183
>>
>> Steps to reproduce:
>>  # mkfs.btrfs -f /dev/sdb
>>  # mount /dev/sdb /mnt -o compress-force=lzo
>>  # mount /dev/sdb /mnt -o remount,compress=zlib
>>  # cat /proc/mounts
>>
>> Remounting from compress-force to compress could not clear compress-force
>> option. The problem is there is no way for users to clear compress-force
>> option separately.
>>
>> Fix this problem by clearing @FORCE_COMPRESS flag when remounting to
>> compress=xxx.
>>
>> Suggested-by: Tsutomu Itoh <t-itoh at jp.fujitsu.com>
>> Signed-off-by: Wang Shilong <wangsl.fnst at cn.fujitsu.com>
>> Reviewed-by: David Sterba <dsterba at suse.cz>
>> Reviewed-by: Satoru Takeuchi <takeuchi_satoru at jp.fujitsu.com>
>> Tested-by: Satoru Takeuchi <takeuchi_satoru at jp.fujitsu.com>
>> Signed-off-by: Chris Mason <clm at fb.com>
>> (backport from upstream commit 4027e0f4c4b2df28d564560a3c65c179bebae4c8)
>> Signed-off-by: Colin Ian King <colin.king at canonical.com>
>> ---
>>  fs/btrfs/super.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
>> index d71a11d..53d1cac 100644
>> --- a/fs/btrfs/super.c
>> +++ b/fs/btrfs/super.c
>> @@ -475,6 +475,13 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
>>  			} else if (btrfs_test_opt(root, COMPRESS)) {
>>  				pr_info("btrfs: use %s compression\n",
>>  					compress_type);
>> +				/*
>> +				 * If we remount from compress-force=xxx to
>> +				 * compress=xxx, we need clear FORCE_COMPRESS
>> +				 * flag, otherwise, there is no way for users
>> +				 * to disable forcible compression separately.
>> +				 */
>> +				btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);
> 
> 
> I am getting confused here. And the original commit is sufficiently odd, too. So
> there force_compress is cleared whenever not using force_compress and the
> message is printed when *not* using compress, huh?
> This backport maybe is even more correct to what is intended but might behave
> slightly different...

I believe the back port is doing as the original patch intended to do,
and also the test case does show that this one-liner is doing as
intended.  But yes, I agree that the code upstream does seem odd,
perhaps I should have included commit
078025347c8ed43ff330e392476d8866ac1b297f "btrfs: Cleanup the
btrfs_parse_options for remount." with this fix to keep it the same as
the upstream code.  However, I think the current fix is sane wrt to what
we need to get fixed in this corner case bug.

>>  			}
>>  			break;
>>  		case Opt_ssd:
>>
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJVC/PsAAoJEGjCh9/GqAImgNAP/1fgH7bpDfPvNYNCAyrbfpnN
XbRg6qLBbP/cJbF9BZKVnoY9T2tCMPw2IIL4vnrOtvrx9qREp7XuqwB9r2uYWgNo
3LvnPzdAHY0kkfwi6fcFAO2NKU84WVlcH+wIlEdzkBnYG04RGJfORIJKf1TmQa/a
o0Lf83BPRN3Zh2o6cQMX7kWVz7WO6ZTyXEcoyc851wPcAk7t1gqwrlG71Fzk3GpZ
rO+KP8cQ2BFG6WkcYKrN8Ey1L7T000ChP5SsFa01gokQAMyKvsU3+EBTosRJul1Q
dWuNkR4gw5BqU8NrSFYDqN3bRltA85y9ObTho6KxRRe7+9K/MpJAaF8jYf6XayYC
q/yCbPcRlk+FBMlnodpRoQTMT+RDy/NtoP5ZRRygNH+l9C59pdwaPt0IlotBWN8F
BUAFZx3F2zHDRzego/ABYJFJwTua1HEwzlSDFwneNOT0VY/SzdK4s9jz0eE8RiF0
Il5Igb0bxF+EzGmIY+lIfhIakxGGDk1KbSSXJcGp2NaM86YgO0G4qSrsHsPEyWNd
L9+1tftL3o5npkmTm50BJG3beHvYG+Lihav6Ep+ftUAe3y95SGfU+5X3T3sDzcWV
qt/bGbXzk8WDQlNufjGfP4do5klbGo9so3iIqlntXMWNVAFYQX/aRxraj2xERiDt
F6FSztsyL6XGtIPdFtZ0
=5JO7
-----END PGP SIGNATURE-----




More information about the kernel-team mailing list