Skip to content

Commit

Permalink
Merge tag 'nfsd-6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/cel/linux

Pull nfsd fix from Chuck Lever:
 "Address an NFSD regression introduced during the 6.0 merge window"

* tag 'nfsd-6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
  NFSD: fix regression with setting ACLs.
  • Loading branch information
Linus Torvalds committed Sep 12, 2022
2 parents 80e78fc + 00801cd commit 62d1cea
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ commit_metadata(struct svc_fh *fhp)
static void
nfsd_sanitize_attrs(struct inode *inode, struct iattr *iap)
{
/* Ignore mode updates on symlinks */
if (S_ISLNK(inode->i_mode))
iap->ia_valid &= ~ATTR_MODE;

/* sanitize the mode change */
if (iap->ia_valid & ATTR_MODE) {
iap->ia_mode &= S_IALLUGO;
Expand Down Expand Up @@ -353,7 +357,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
int accmode = NFSD_MAY_SATTR;
umode_t ftype = 0;
__be32 err;
int host_err;
int host_err = 0;
bool get_write_count;
bool size_change = (iap->ia_valid & ATTR_SIZE);

Expand Down Expand Up @@ -391,13 +395,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
dentry = fhp->fh_dentry;
inode = d_inode(dentry);

/* Ignore any mode updates on symlinks */
if (S_ISLNK(inode->i_mode))
iap->ia_valid &= ~ATTR_MODE;

if (!iap->ia_valid)
return 0;

nfsd_sanitize_attrs(inode, iap);

if (check_guard && guardtime != inode->i_ctime.tv_sec)
Expand Down Expand Up @@ -448,8 +445,10 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
goto out_unlock;
}

iap->ia_valid |= ATTR_CTIME;
host_err = notify_change(&init_user_ns, dentry, iap, NULL);
if (iap->ia_valid) {
iap->ia_valid |= ATTR_CTIME;
host_err = notify_change(&init_user_ns, dentry, iap, NULL);
}

out_unlock:
if (attr->na_seclabel && attr->na_seclabel->len)
Expand Down

0 comments on commit 62d1cea

Please sign in to comment.