Re: [PATCH v3 0/2] nfsd: sanely handle inabilty to fetch pre/post attributes

From: Chuck Lever
Date: Fri Jul 21 2023 - 12:52:45 EST


On Fri, Jul 21, 2023 at 10:29:09AM -0400, Jeff Layton wrote:
> Boyang reported tripping the BUG_ON in set_change_info. While we
> couldn't confirm it, one way this could happen would be for nfsd_lookup
> to succeed and then for fh_fill_both_attrs to fail.
>
> This patchset attempts to (sanely) fix this, usually by aborting the
> operation if fetching the pre attributes fails. Post-op attribute fetch
> handling is more difficult to deal with however since we've already done
> the operation, so this has it just fudge the change_info4 if that
> occurs.
>
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>

Applied v3 to nfsd-next. Thanks!


> ---
> Changes in v2:
> - rework the error paths to consistently use gotos
> - add __must_check to fh_fill_pre_attrs and fh_fill_both_attrs
> - fix bad error handling in setxattr codepath
>
> ---
> Jeff Layton (2):
> nfsd: handle failure to collect pre/post-op attrs more sanely
> nfsd: remove unsafe BUG_ON from set_change_info
>
> fs/nfsd/nfs3proc.c | 4 +++-
> fs/nfsd/nfs4proc.c | 46 ++++++++++++++++++++++++++++++++++++++++------
> fs/nfsd/nfsfh.c | 26 ++++++++++++++++----------
> fs/nfsd/nfsfh.h | 6 +++---
> fs/nfsd/vfs.c | 52 +++++++++++++++++++++++++++++++++++-----------------
> fs/nfsd/xdr4.h | 11 -----------
> 6 files changed, 97 insertions(+), 48 deletions(-)
> ---
> base-commit: c9194156c1039499533303fc63a66b0f1399896b
> change-id: 20230720-bz2223560-9c4690a8217b
>
> Best regards,
> --
> Jeff Layton <jlayton@xxxxxxxxxx>
>