Commit a24a6c05 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'nfsd-5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/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
parents 4adfa865 1197eb59
...@@ -176,7 +176,7 @@ nlm_delete_file(struct nlm_file *file) ...@@ -176,7 +176,7 @@ 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; struct file_lock lock;
...@@ -184,6 +184,7 @@ static int nlm_unlock_files(struct nlm_file *file) ...@@ -184,6 +184,7 @@ static int nlm_unlock_files(struct nlm_file *file)
lock.fl_type = F_UNLCK; lock.fl_type = F_UNLCK;
lock.fl_start = 0; lock.fl_start = 0;
lock.fl_end = OFFSET_MAX; lock.fl_end = OFFSET_MAX;
lock.fl_owner = owner;
if (file->f_file[O_RDONLY] && if (file->f_file[O_RDONLY] &&
vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL)) vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
goto out_err; goto out_err;
...@@ -225,7 +226,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file, ...@@ -225,7 +226,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file,
if (match(lockhost, host)) { if (match(lockhost, host)) {
spin_unlock(&flctx->flc_lock); spin_unlock(&flctx->flc_lock);
if (nlm_unlock_files(file)) if (nlm_unlock_files(file, fl->fl_owner))
return 1; return 1;
goto again; goto again;
} }
...@@ -282,11 +283,10 @@ nlm_file_inuse(struct nlm_file *file) ...@@ -282,11 +283,10 @@ nlm_file_inuse(struct nlm_file *file)
static void nlm_close_files(struct nlm_file *file) static void nlm_close_files(struct nlm_file *file)
{ {
struct file *f; if (file->f_file[O_RDONLY])
nlmsvc_ops->fclose(file->f_file[O_RDONLY]);
for (f = file->f_file[0]; f <= file->f_file[1]; f++) if (file->f_file[O_WRONLY])
if (f) nlmsvc_ops->fclose(file->f_file[O_WRONLY]);
nlmsvc_ops->fclose(f);
} }
/* /*
......
...@@ -470,6 +470,15 @@ nfsd4_decode_fattr4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen, ...@@ -470,6 +470,15 @@ nfsd4_decode_fattr4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen,
return nfserr_bad_xdr; 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) { if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) {
u32 set_it; u32 set_it;
......
...@@ -465,7 +465,8 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval) ...@@ -465,7 +465,8 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval)
(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL) (FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL)
#define NFSD_WRITEABLE_ATTRS_WORD1 \ #define NFSD_WRITEABLE_ATTRS_WORD1 \
(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ (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 #ifdef CONFIG_NFSD_V4_SECURITY_LABEL
#define MAYBE_FATTR4_WORD2_SECURITY_LABEL \ #define MAYBE_FATTR4_WORD2_SECURITY_LABEL \
FATTR4_WORD2_SECURITY_LABEL FATTR4_WORD2_SECURITY_LABEL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment