Commit c5aa1e55 authored by Al Viro's avatar Al Viro

close the race in nlmsvc_free_block()

we need to grab mutex before the reference counter reaches 0
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 156cacb1
...@@ -289,7 +289,6 @@ static void nlmsvc_free_block(struct kref *kref) ...@@ -289,7 +289,6 @@ static void nlmsvc_free_block(struct kref *kref)
dprintk("lockd: freeing block %p...\n", block); dprintk("lockd: freeing block %p...\n", block);
/* Remove block from file's list of blocks */ /* Remove block from file's list of blocks */
mutex_lock(&file->f_mutex);
list_del_init(&block->b_flist); list_del_init(&block->b_flist);
mutex_unlock(&file->f_mutex); mutex_unlock(&file->f_mutex);
...@@ -303,7 +302,7 @@ static void nlmsvc_free_block(struct kref *kref) ...@@ -303,7 +302,7 @@ static void nlmsvc_free_block(struct kref *kref)
static void nlmsvc_release_block(struct nlm_block *block) static void nlmsvc_release_block(struct nlm_block *block)
{ {
if (block != NULL) if (block != NULL)
kref_put(&block->b_count, nlmsvc_free_block); kref_put_mutex(&block->b_count, nlmsvc_free_block, &block->b_file->f_mutex);
} }
/* /*
......
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