From: Anand Jain <Anand.Jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org, nborisov@suse.com
Subject: Re: [PATCH 0/4] property fixes and cleanups
Date: Tue, 9 Apr 2019 13:34:04 +0800 [thread overview]
Message-ID: <fd0c91a6-6c7d-6acc-464f-da25557511d6@oracle.com> (raw)
In-Reply-To: <20190408232320.GE29086@twin.jikos.cz>
On 9/4/19 7:23 AM, David Sterba wrote:
> On Mon, Apr 08, 2019 at 07:02:14PM +0200, David Sterba wrote:
>> On Thu, Apr 04, 2019 at 12:51:30AM +0800, Anand Jain wrote:
>>> Both mainline and misc-5.2 fails the test case that transaction
>>> generation number must be unaltered if the property validation fails.
>>>
>>> For example:
>>> btrfs in dump-super /dev/sdb | grep ^generation; \
>>> btrfs prop set /btrfs compression lz; sync; \
>>> btrfs in dump-super /dev/sdb | grep ^generation
>>> generation 53
>>> ERROR: failed to set compression for /btrfs: Invalid argument
>>> generation 54
>>>
>>> Which the patch in the mailing list fixes and based on misc-5.2
>>> [PATCH 4/4 RESEND] btrfs: fix property validate fail should not increment
>>>
>>> But, now I notice that the reason for which the original code failed
>>> is different from the reason for which misc-5.2 failed. Former failed
>>> because the malformed 'lz' was only abled to be caught by handle->apply(),
>>> and in latter we were calling the start_transaction() too early before the
>>> handle->validation() which few of the patches in misc-5.1 did. My bad.
>>>
>>> As per your misc-5.2 branch please drop the following patches as I have
>>> better fixes as in this patch.
>>>
>>> 584aebf26bbf btrfs: merge btrfs_setxattr and do_setxattr
>>> ab54ee38fff7 btrfs: don't create transaction in btrfs_setxattr
>>> 0cbf560f72e1 btrfs: start transaction in btrfs_xattr_handler_set
>>> db0f220e98eb btrfs: start transaction in btrfs_set_acl
>>> 56e9e992c00a btrfs: start transaction in btrfs_set_prop_trans
>>> 3e2299ea6a8b btrfs: refactor btrfs_set_prop and add btrfs_set_prop_trans
>>> 737e67ce0f3f btrfs: merge _btrfs_set_prop helpers
>>>
>>> And please apply the patches as in this set.
>>>
>>> Anand Jain (4):
>>> btrfs: rename __btrfs_set_prop to btrfs_set_prop_trans
>>> btrfs: rename __btrfs_set_acl to do_set_acl
>>> btrfs: fix zstd compression parameter
>>> btrfs: fix vanished compression property after failed set
>>
>> I'm going to send the two fixes independently to 5.1 as they affect
>> current code. Regarding the increased transaction, I don't want to drop
>> the patches that move transaction around just yet, as they're 100
>> patches deep in the devel queue.
>
> I've checked how much conflicts it creates, just one so that's not a
> problem with removing.
>
>> The validation should happen before the transaction, the code currently
>> does a few nested calls so this might need further cleanups but I'd
>> rather go that way than to deleting what's in misc-next and starting
>> again.
>> If deleting the current misc-next patches appears to be a better option
>> in the end, then I'll do that.
> So, the removed patches are:
[1]
> - btrfs: merge btrfs_setxattr and do_setxattr
> - btrfs: don't create transaction in btrfs_setxattr
> - btrfs: start transaction in btrfs_xattr_handler_set
> - btrfs: start transaction in btrfs_set_acl
> - btrfs: start transaction in btrfs_set_prop_trans
>
> There was one conflict with 'btrfs: Defer setting new inode mode until
> after do_set_acl succeeds' that I removed as the patch depended on the
> transaction in the function.
>
> The inode flags that have a corresponding property, handled in
> btrfs_ioctl_setflags, need to be enclosed in the same transaction so
> they don't get out of sync. This will require splitting the validation
> and actual change, which will require restructuring the setflags
> function too.
>
You are right. So moving the start_transaction upward was right.
Which means reverting these patches aren't good idea, so that
we can enclose inode flag changes in the same transaction.
Also similarly btrfs_set_acl() -> do_set_acl() should open code
the do_set_acl() in btrfs_set_acl() so that it can start the
transaction after all checks.
Are you ok to keep these above patches [1], sorry now I have
a stronger reason why we should start transaction in the parent
functions.
Thanks, Anand
prev parent reply other threads:[~2019-04-09 5:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-03 16:51 [PATCH 0/4] property fixes and cleanups Anand Jain
2019-04-03 16:51 ` [PATCH 1/4] btrfs: rename __btrfs_set_prop to btrfs_set_prop_trans Anand Jain
2019-04-03 16:51 ` [PATCH 2/4] btrfs: rename __btrfs_set_acl to do_set_acl Anand Jain
2019-04-03 16:51 ` [PATCH 3/4] btrfs: fix zstd compression parameter Anand Jain
2019-04-03 16:51 ` [PATCH 4/4] btrfs: fix vanished compression property after failed set Anand Jain
2019-04-08 3:25 ` [PATCH 0/4] property fixes and cleanups Anand Jain
2019-04-08 17:02 ` David Sterba
2019-04-08 23:23 ` David Sterba
2019-04-09 5:34 ` Anand Jain [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fd0c91a6-6c7d-6acc-464f-da25557511d6@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).