瀏覽代碼

lockd: Remove FL_LOCKD flag

Currently lockd identifies its own locks using the FL_LOCKD flag.  This
doesn't scale well to multiple lock managers--if we did this in nfsv4 too,
for example, we'd be left with only one free flag bit.

Instead, we just check whether the file manager ops (fl_lmops) set on this
lock are our own.

The only use for this is in nlm_traverse_locks, which uses it to find locks
that need cleaning up when freeing a host or a file.

In the long run it might be nice to do reference counting instead of
traversing all the locks like this....

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
J. Bruce Fields 19 年之前
父節點
當前提交
7117bf3dfb
共有 3 個文件被更改,包括 1 次插入4 次删除
  1. 0 2
      fs/lockd/svclock.c
  2. 1 1
      fs/lockd/svcsubs.c
  3. 0 1
      include/linux/fs.h

+ 0 - 2
fs/lockd/svclock.c

@@ -313,8 +313,6 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
 	/* Get existing block (in case client is busy-waiting) */
 	/* Get existing block (in case client is busy-waiting) */
 	block = nlmsvc_lookup_block(file, lock, 0);
 	block = nlmsvc_lookup_block(file, lock, 0);
 
 
-	lock->fl.fl_flags |= FL_LOCKD;
-
 again:
 again:
 	/* Lock file against concurrent access */
 	/* Lock file against concurrent access */
 	down(&file->f_sema);
 	down(&file->f_sema);

+ 1 - 1
fs/lockd/svcsubs.c

@@ -182,7 +182,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file, int action)
 again:
 again:
 	file->f_locks = 0;
 	file->f_locks = 0;
 	for (fl = inode->i_flock; fl; fl = fl->fl_next) {
 	for (fl = inode->i_flock; fl; fl = fl->fl_next) {
-		if (!(fl->fl_flags & FL_LOCKD))
+		if (fl->fl_lmops != &nlmsvc_lock_operations)
 			continue;
 			continue;
 
 
 		/* update current lock count */
 		/* update current lock count */

+ 0 - 1
include/linux/fs.h

@@ -667,7 +667,6 @@ extern spinlock_t files_lock;
 #define FL_POSIX	1
 #define FL_POSIX	1
 #define FL_FLOCK	2
 #define FL_FLOCK	2
 #define FL_ACCESS	8	/* not trying to lock, just looking */
 #define FL_ACCESS	8	/* not trying to lock, just looking */
-#define FL_LOCKD	16	/* lock held by rpc.lockd */
 #define FL_LEASE	32	/* lease held on this file */
 #define FL_LEASE	32	/* lease held on this file */
 #define FL_SLEEP	128	/* A blocking lock */
 #define FL_SLEEP	128	/* A blocking lock */