diff options
author | Gunnar Beutner <[email protected]> | 2011-10-11 09:50:52 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-10-11 09:51:51 -0700 |
commit | 763b2f3b57af1febb0fd72c4976992e672a350b4 (patch) | |
tree | 6b200156baaffd6213e47ea2642ea74fc2939495 /module/spl/spl-vnode.c | |
parent | 4a777c028c7e52ccfc1fb721448c84e10b9ee0f8 (diff) |
Fixed invalid resource re-use in file_find()
File descriptors are a per-process resource. The same descriptor
in different processes can refer to different files. find_file()
incorrectly assumed that file descriptors are globally unique.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes ZFS issue #386
Diffstat (limited to 'module/spl/spl-vnode.c')
-rw-r--r-- | module/spl/spl-vnode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index c46643175..1b5cc5a08 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -511,7 +511,7 @@ file_find(int fd) ASSERT(spin_is_locked(&vn_file_lock)); list_for_each_entry(fp, &vn_file_list, f_list) { - if (fd == fp->f_fd) { + if (fd == fp->f_fd && fp->f_task == current) { ASSERT(atomic_read(&fp->f_ref) != 0); return fp; } @@ -550,6 +550,7 @@ vn_getf(int fd) mutex_enter(&fp->f_lock); fp->f_fd = fd; + fp->f_task = current; fp->f_offset = 0; atomic_inc(&fp->f_ref); |