提交 a9e61e25 编写于 作者: F Felix Blyakher 提交者: J. Bruce Fields

lockd: call locks_release_private to cleanup per-filesystem state

For every lock request lockd creates a new file_lock object
in nlmsvc_setgrantargs() by copying the passed in file_lock with
locks_copy_lock(). A filesystem can attach it's own lock_operations
vector to the file_lock. It has to be cleaned up at the end of the
file_lock's life. However, lockd doesn't do it today, yet it
asserts in nlmclnt_release_lockargs() that the per-filesystem
state is clean.
This patch fixes it by exporting locks_release_private() and adding
it to nlmsvc_freegrantargs(), to be symmetrical to creating a
file_lock in nlmsvc_setgrantargs().
Signed-off-by: NFelix Blyakher <felixb@sgi.com>
Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
上级 80492e7d
...@@ -326,6 +326,8 @@ static void nlmsvc_freegrantargs(struct nlm_rqst *call) ...@@ -326,6 +326,8 @@ static void nlmsvc_freegrantargs(struct nlm_rqst *call)
{ {
if (call->a_args.lock.oh.data != call->a_owner) if (call->a_args.lock.oh.data != call->a_owner)
kfree(call->a_args.lock.oh.data); kfree(call->a_args.lock.oh.data);
locks_release_private(&call->a_args.lock.fl);
} }
/* /*
......
...@@ -151,7 +151,7 @@ static struct file_lock *locks_alloc_lock(void) ...@@ -151,7 +151,7 @@ static struct file_lock *locks_alloc_lock(void)
return kmem_cache_alloc(filelock_cache, GFP_KERNEL); return kmem_cache_alloc(filelock_cache, GFP_KERNEL);
} }
static void locks_release_private(struct file_lock *fl) void locks_release_private(struct file_lock *fl)
{ {
if (fl->fl_ops) { if (fl->fl_ops) {
if (fl->fl_ops->fl_release_private) if (fl->fl_ops->fl_release_private)
...@@ -165,6 +165,7 @@ static void locks_release_private(struct file_lock *fl) ...@@ -165,6 +165,7 @@ static void locks_release_private(struct file_lock *fl)
} }
} }
EXPORT_SYMBOL_GPL(locks_release_private);
/* Free a lock which is not in use. */ /* Free a lock which is not in use. */
static void locks_free_lock(struct file_lock *fl) static void locks_free_lock(struct file_lock *fl)
......
...@@ -1108,6 +1108,7 @@ extern void locks_copy_lock(struct file_lock *, struct file_lock *); ...@@ -1108,6 +1108,7 @@ extern void locks_copy_lock(struct file_lock *, struct file_lock *);
extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
extern void locks_remove_posix(struct file *, fl_owner_t); extern void locks_remove_posix(struct file *, fl_owner_t);
extern void locks_remove_flock(struct file *); extern void locks_remove_flock(struct file *);
extern void locks_release_private(struct file_lock *);
extern void posix_test_lock(struct file *, struct file_lock *); extern void posix_test_lock(struct file *, struct file_lock *);
extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
extern int posix_lock_file_wait(struct file *, struct file_lock *); extern int posix_lock_file_wait(struct file *, struct file_lock *);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册