linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Allison Collins <allison.henderson@oracle.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v6 11/16] xfs: Check for -ENOATTR or -EEXIST
Date: Sat, 25 Jan 2020 09:41:47 -0700	[thread overview]
Message-ID: <26a49cf4-52df-55bd-67bb-9c0c981a860d@oracle.com> (raw)
In-Reply-To: <68dcf7a7-9e10-2d64-9c5c-d520d2372c2b@oracle.com>

On 1/21/20 9:29 PM, Allison Collins wrote:
> 
> 
> On 1/21/20 4:15 PM, Darrick J. Wong wrote:
>> On Sat, Jan 18, 2020 at 03:50:30PM -0700, Allison Collins wrote:
>>> Delayed operations cannot return error codes.  So we must check for
>>> these conditions first before starting set or remove operations
>>
>> Answering my own question from earlier -- I see here you actually /are/
>> checking the attr existence w.r.t. ATTR_{CREATE,REPLACE} right after we
>> allocate a transaction and ILOCK the inode, so
>>
>> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> Alrighty, thank you!
> 
>>
>> Though I am wondering if you could discard the predicates from the
>> second patch in favor of doing a normal lookup of the attr with a zero
>> valuelen to determine if there's already an attribute?
> I think I likely answered this in the response to that patch.  Because 
> it's used as part of the remove procedures, we still need it.  We could 
> make a simpler version just for this application I suppose, but it seems 
> like it'd just be extra code since we still need the former.
> 
> Thank you for the reviews!
> Allison
> 
>>
>> --D
>>
>>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
>>> ---
>>>   fs/xfs/libxfs/xfs_attr.c | 12 ++++++++++++
>>>   1 file changed, 12 insertions(+)
>>>
>>> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
>>> index a2673fe..e9d22c1 100644
>>> --- a/fs/xfs/libxfs/xfs_attr.c
>>> +++ b/fs/xfs/libxfs/xfs_attr.c
>>> @@ -457,6 +457,14 @@ xfs_attr_set(
>>>           goto out_trans_cancel;
>>>       xfs_trans_ijoin(args.trans, dp, 0);
>>> +
>>> +    error = xfs_has_attr(&args);
>>> +    if (error == -EEXIST && (name->type & ATTR_CREATE))
>>> +        goto out_trans_cancel;
>>> +
>>> +    if (error == -ENOATTR && (name->type & ATTR_REPLACE))
>>> +        goto out_trans_cancel;
>>> +
>>>       error = xfs_attr_set_args(&args);
So I was thinking of adding this one to a smaller 3 patch series I 
mentioned earlier.  I was also thinking of adding in some asserts here:

ASSERT(error != -EEXIST)
ASSERT(error != -ENOATTR)

Just to make sure the changes are enforcing the behavioral changes that 
we want.  I thought this might be a good stabilizer to the rest of the 
delayed attr series.  Because chasing this bug back up through the log 
replay is a much bigger PITA than catching it here.  Thoughts?

>>>       if (error)
>>>           goto out_trans_cancel;
>>> @@ -545,6 +553,10 @@ xfs_attr_remove(
>>>        */
>>>       xfs_trans_ijoin(args.trans, dp, 0);
>>> +    error = xfs_has_attr(&args);
>>> +    if (error != -EEXIST)
>>> +        goto out;
>>> +
Here too:
ASSERT(error != -EEXIST)

Let me know what folks think.  Thanks!

Allison

>>>       error = xfs_attr_remove_args(&args);
>>>       if (error)
>>>           goto out;
>>> -- 
>>> 2.7.4
>>>

  reply	other threads:[~2020-01-25 16:41 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-18 22:50 [PATCH v6 00/16] xfs: Delay Ready Attributes Allison Collins
2020-01-18 22:50 ` [PATCH v6 01/16] xfs: Replace attribute parameters with struct xfs_name Allison Collins
2020-01-21 22:08   ` Darrick J. Wong
2020-01-18 22:50 ` [PATCH v6 02/16] xfs: Embed struct xfs_name in xfs_da_args Allison Collins
2020-01-21 22:15   ` Darrick J. Wong
2020-01-18 22:50 ` [PATCH v6 03/16] xfs: Add xfs_has_attr and subroutines Allison Collins
2020-01-21 22:48   ` Darrick J. Wong
2020-01-22  3:17     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 04/16] xfs: Factor out new helper functions xfs_attr_rmtval_set Allison Collins
2020-01-18 22:50 ` [PATCH v6 05/16] xfs: Factor out trans handling in xfs_attr3_leaf_flipflags Allison Collins
2020-01-18 22:50 ` [PATCH v6 06/16] xfs: Factor out xfs_attr_leaf_addname helper Allison Collins
2020-01-21 23:01   ` Darrick J. Wong
2020-01-22  4:15     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 07/16] xfs: Refactor xfs_attr_try_sf_addname Allison Collins
2020-01-21 23:07   ` Darrick J. Wong
2020-01-22  4:17     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 08/16] xfs: Factor out trans roll from xfs_attr3_leaf_setflag Allison Collins
2020-01-18 22:50 ` [PATCH v6 09/16] xfs: Factor out xfs_attr_rmtval_invalidate Allison Collins
2020-01-18 22:50 ` [PATCH v6 10/16] xfs: Factor out trans roll in xfs_attr3_leaf_clearflag Allison Collins
2020-01-18 22:50 ` [PATCH v6 11/16] xfs: Check for -ENOATTR or -EEXIST Allison Collins
2020-01-21 23:15   ` Darrick J. Wong
2020-01-22  4:29     ` Allison Collins
2020-01-25 16:41       ` Allison Collins [this message]
2020-01-26 22:28         ` Darrick J. Wong
2020-01-27  0:20           ` Allison Collins
2020-01-30 22:58             ` Darrick J. Wong
2020-01-18 22:50 ` [PATCH v6 12/16] xfs: Add helper function xfs_attr_init_unmapstate Allison Collins
2020-01-21 23:21   ` Darrick J. Wong
2020-01-22  5:05     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 13/16] xfs: Add helper function xfs_attr_rmtval_unmap Allison Collins
2020-01-21 23:24   ` Darrick J. Wong
2020-01-22  5:23     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 14/16] xfs: Simplify xfs_attr_set_args Allison Collins
2020-01-21 23:31   ` Darrick J. Wong
2020-01-22  7:39     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 15/16] xfs: Add delay ready attr remove routines Allison Collins
2020-01-22  0:02   ` Darrick J. Wong
2020-01-22  9:32     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 16/16] xfs: Add delay ready attr set routines Allison Collins
2020-01-22  0:12   ` Darrick J. Wong
2020-01-22 10:30     ` Allison Collins
2020-02-05 23:07       ` Allison Collins
2020-01-22 16:57     ` Allison Collins
2020-01-22 17:04       ` Allison Collins

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=26a49cf4-52df-55bd-67bb-9c0c981a860d@oracle.com \
    --to=allison.henderson@oracle.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /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).