Re: [RFC - PATCH] xfs: hold xfs_buf locked between shortform->leaf conversion and the addition of the first attribute

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

 



Hi Darrick,

[...]

> I'm confused and going to step through through this code one piece at a time.
>
>         /*
>          * It won't fit in the shortform, transform to a leaf block.
>          * GROT: another possible req'mt for a double-split btree op.
>          */
>         xfs_defer_init(args.dfops, args.firstblock);
>         error = xfs_attr_shortform_to_leaf(&args, &leaf_bp);
>
>         /* hold the leaf buffer locked, when "args.trans" transaction commits */
>         if (leaf_bp)
>                 xfs_trans_bhold(args.trans, leaf_bp);
>
> If we hit an error in xfs_attr_shortform_to_leaf leaf_bp will have been
> bjoined to args.trans by xfs_attr_shortform_to_leaf ->
> xfs_attr3_leaf_create -> xfs_da_get_buf -> xfs_trans_get_buf_map, so
> when we goto out in the error handling clause below, we'll trans_cancel,
> which releases leaf_bp, right?  And we can't just xfs_buf_relse because
> that would unlock a buffer that's still owned by args.trans (like Brian
> said)...
If xfs_attr_shortform_to_leaf() hits an error, it will not set the
caller's leaf_bp pointer. So this pointer will remain NULL, and
therefore all the error handing logic at the caller will not touch
this xfs_buf. I believe this addresses your concern.

Thanks,
Alex.
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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