Skip to content

Commit a24a6c0

Browse files
committed
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
2 parents 4adfa86 + 1197eb5 commit a24a6c0

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

fs/lockd/svcsubs.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,15 @@ nlm_delete_file(struct nlm_file *file)
176176
}
177177
}
178178

179-
static int nlm_unlock_files(struct nlm_file *file)
179+
static int nlm_unlock_files(struct nlm_file *file, fl_owner_t owner)
180180
{
181181
struct file_lock lock;
182182

183183
locks_init_lock(&lock);
184184
lock.fl_type = F_UNLCK;
185185
lock.fl_start = 0;
186186
lock.fl_end = OFFSET_MAX;
187+
lock.fl_owner = owner;
187188
if (file->f_file[O_RDONLY] &&
188189
vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
189190
goto out_err;
@@ -225,7 +226,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file,
225226
if (match(lockhost, host)) {
226227

227228
spin_unlock(&flctx->flc_lock);
228-
if (nlm_unlock_files(file))
229+
if (nlm_unlock_files(file, fl->fl_owner))
229230
return 1;
230231
goto again;
231232
}
@@ -282,11 +283,10 @@ nlm_file_inuse(struct nlm_file *file)
282283

283284
static void nlm_close_files(struct nlm_file *file)
284285
{
285-
struct file *f;
286-
287-
for (f = file->f_file[0]; f <= file->f_file[1]; f++)
288-
if (f)
289-
nlmsvc_ops->fclose(f);
286+
if (file->f_file[O_RDONLY])
287+
nlmsvc_ops->fclose(file->f_file[O_RDONLY]);
288+
if (file->f_file[O_WRONLY])
289+
nlmsvc_ops->fclose(file->f_file[O_WRONLY]);
290290
}
291291

292292
/*

fs/nfsd/nfs4xdr.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,15 @@ nfsd4_decode_fattr4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen,
470470
return nfserr_bad_xdr;
471471
}
472472
}
473+
if (bmval[1] & FATTR4_WORD1_TIME_CREATE) {
474+
struct timespec64 ts;
475+
476+
/* No Linux filesystem supports setting this attribute. */
477+
bmval[1] &= ~FATTR4_WORD1_TIME_CREATE;
478+
status = nfsd4_decode_nfstime4(argp, &ts);
479+
if (status)
480+
return status;
481+
}
473482
if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) {
474483
u32 set_it;
475484

fs/nfsd/nfsd.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval)
465465
(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL)
466466
#define NFSD_WRITEABLE_ATTRS_WORD1 \
467467
(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
468-
| FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
468+
| FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_CREATE \
469+
| FATTR4_WORD1_TIME_MODIFY_SET)
469470
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
470471
#define MAYBE_FATTR4_WORD2_SECURITY_LABEL \
471472
FATTR4_WORD2_SECURITY_LABEL

0 commit comments

Comments
 (0)