Commit 90d2f1da authored by Trond Myklebust's avatar Trond Myklebust Committed by J. Bruce Fields

nfsd: Fix a soft lockup race in nfsd_file_mark_find_or_create()

If nfsd_file_mark_find_or_create() keeps winning the race for the
nfsd_file_fsnotify_group->mark_mutex against nfsd_file_mark_put()
then it can soft lock up, since fsnotify_add_inode_mark() ends
up always finding an existing entry.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent b6669305
...@@ -132,9 +132,13 @@ nfsd_file_mark_find_or_create(struct nfsd_file *nf) ...@@ -132,9 +132,13 @@ nfsd_file_mark_find_or_create(struct nfsd_file *nf)
struct nfsd_file_mark, struct nfsd_file_mark,
nfm_mark)); nfm_mark));
mutex_unlock(&nfsd_file_fsnotify_group->mark_mutex); mutex_unlock(&nfsd_file_fsnotify_group->mark_mutex);
fsnotify_put_mark(mark); if (nfm) {
if (likely(nfm)) fsnotify_put_mark(mark);
break; break;
}
/* Avoid soft lockup race with nfsd_file_mark_put() */
fsnotify_destroy_mark(mark, nfsd_file_fsnotify_group);
fsnotify_put_mark(mark);
} else } else
mutex_unlock(&nfsd_file_fsnotify_group->mark_mutex); mutex_unlock(&nfsd_file_fsnotify_group->mark_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