Skip to content

Commit

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

Pull nfsd fixes from Chuck Lever:
 "Notable regression fixes:

   - Enable SETATTR(time_create) to fix regression with Mac OS clients

   - Fix a lockd crasher and broken NLM UNLCK behavior"

* tag 'nfsd-5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
  lockd: fix nlm_close_files
  lockd: set fl_owner when unlocking files
  NFSD: Decode NFSv4 birth time attribute
  • Loading branch information
torvalds committed Jul 14, 2022
2 parents 4adfa86 + 1197eb5 commit a24a6c0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
14 changes: 7 additions & 7 deletions fs/lockd/svcsubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,15 @@ nlm_delete_file(struct nlm_file *file)
}
}

static int nlm_unlock_files(struct nlm_file *file)
static int nlm_unlock_files(struct nlm_file *file, fl_owner_t owner)
{
struct file_lock lock;

locks_init_lock(&lock);
lock.fl_type = F_UNLCK;
lock.fl_start = 0;
lock.fl_end = OFFSET_MAX;
lock.fl_owner = owner;
if (file->f_file[O_RDONLY] &&
vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
goto out_err;
Expand Down Expand Up @@ -225,7 +226,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file,
if (match(lockhost, host)) {

spin_unlock(&flctx->flc_lock);
if (nlm_unlock_files(file))
if (nlm_unlock_files(file, fl->fl_owner))
return 1;
goto again;
}
Expand Down Expand Up @@ -282,11 +283,10 @@ nlm_file_inuse(struct nlm_file *file)

static void nlm_close_files(struct nlm_file *file)
{
struct file *f;

for (f = file->f_file[0]; f <= file->f_file[1]; f++)
if (f)
nlmsvc_ops->fclose(f);
if (file->f_file[O_RDONLY])
nlmsvc_ops->fclose(file->f_file[O_RDONLY]);
if (file->f_file[O_WRONLY])
nlmsvc_ops->fclose(file->f_file[O_WRONLY]);
}

/*
Expand Down
9 changes: 9 additions & 0 deletions fs/nfsd/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ nfsd4_decode_fattr4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen,
return nfserr_bad_xdr;
}
}
if (bmval[1] & FATTR4_WORD1_TIME_CREATE) {
struct timespec64 ts;

/* No Linux filesystem supports setting this attribute. */
bmval[1] &= ~FATTR4_WORD1_TIME_CREATE;
status = nfsd4_decode_nfstime4(argp, &ts);
if (status)
return status;
}
if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) {
u32 set_it;

Expand Down
3 changes: 2 additions & 1 deletion fs/nfsd/nfsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval)
(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL)
#define NFSD_WRITEABLE_ATTRS_WORD1 \
(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
| FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
| FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_CREATE \
| FATTR4_WORD1_TIME_MODIFY_SET)
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
#define MAYBE_FATTR4_WORD2_SECURITY_LABEL \
FATTR4_WORD2_SECURITY_LABEL
Expand Down

0 comments on commit a24a6c0

Please sign in to comment.