Re: [PATCH v7 04/19] xfs: Check for -ENOATTR or -EEXIST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/23/20 5:25 AM, Amir Goldstein wrote:
On Sun, Feb 23, 2020 at 4:07 AM Allison Collins
<allison.henderson@xxxxxxxxxx> wrote:

Delayed operations cannot return error codes.  So we must check for these conditions
first before starting set or remove operations

Signed-off-by: Allison Collins <allison.henderson@xxxxxxxxxx>
Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
  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 2255060..a2f812f 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -437,6 +437,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;
+

And we do care about other errors?

I guess they would surface during the set operation as they do now, though it's probably better to catch it here. Will add! Thanks!

Allison


Thanks,
Amir.




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux