Skip to content

Commit 9189d23

Browse files
committed
lockd: Remove unneeded initialization of file_lock::c.flc_flags
Since commit 75c7940 ("lockd: set missing fl_flags field when retrieving args"), nlmsvc_retrieve_args() initializes the flc_flags field. svcxdr_decode_lock() no longer needs to do this. This clean up removes one dependency on the nlm_lock:fl field. No behavior change is expected. Analysis: svcxdr_decode_lock() is called by: nlm4svc_decode_testargs() nlm4svc_decode_lockargs() nlm4svc_decode_cancargs() nlm4svc_decode_unlockargs() nlm4svc_decode_testargs() is used by: - NLMPROC4_TEST and NLMPROC4_TEST_MSG, which call nlmsvc_retrieve_args() - NLMPROC4_GRANTED and NLMPROC4_GRANTED_MSG, which don't pass the lock's file_lock to the generic lock API nlm4svc_decode_lockargs() is used by: - NLMPROC4_LOCK and NLM4PROC4_LOCK_MSG, which call nlmsvc_retrieve_args() - NLMPROC4_UNLOCK and NLM4PROC4_UNLOCK_MSG, which call nlmsvc_retrieve_args() - NLMPROC4_NM_LOCK, which calls nlmsvc_retrieve_args() nlm4svc_decode_cancargs() is used by: - NLMPROC4_CANCEL and NLMPROC4_CANCEL_MSG, which call nlmsvc_retrieve_args() nlm4svc_decode_unlockargs() is used by: - NLMPROC4_UNLOCK and NLMPROC4_UNLOCK_MSG, which call nlmsvc_retrieve_args() All callers except GRANTED/GRANTED_MSG eventually call nlmsvc_retrieve_args() before using nlm_lock::fl.c.flc_flags. Thus this change is safe. Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 8994a51 commit 9189d23

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

fs/lockd/svc4proc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
4646
if (filp != NULL) {
4747
int mode = lock_to_openmode(&lock->fl);
4848

49+
lock->fl.c.flc_flags = FL_POSIX;
50+
4951
error = nlm_lookup_file(rqstp, &file, lock);
5052
if (error)
5153
goto no_locks;
5254
*filp = file;
5355

5456
/* Set up the missing parts of the file_lock structure */
55-
lock->fl.c.flc_flags = FL_POSIX;
56-
lock->fl.c.flc_file = file->f_file[mode];
57+
lock->fl.c.flc_file = file->f_file[mode];
5758
lock->fl.c.flc_pid = current->tgid;
5859
lock->fl.fl_start = (loff_t)lock->lock_start;
5960
lock->fl.fl_end = lock->lock_len ?

fs/lockd/xdr4.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock)
8989
return false;
9090

9191
locks_init_lock(fl);
92-
fl->c.flc_flags = FL_POSIX;
9392
fl->c.flc_type = F_RDLCK;
9493
nlm4svc_set_file_lock_range(fl, lock->lock_start, lock->lock_len);
9594
return true;

0 commit comments

Comments
 (0)