diff --git a/include/sys/vnode.h b/include/sys/vnode.h index 7d655e5ef..36605ca4a 100644 --- a/include/sys/vnode.h +++ b/include/sys/vnode.h @@ -158,6 +158,7 @@ typedef struct vnode { typedef struct vn_file { int f_fd; /* linux fd for lookup */ + struct task_struct *f_task; /* linux task this fd belongs to */ struct file *f_file; /* linux file struct */ atomic_t f_ref; /* ref count */ kmutex_t f_lock; /* struct lock */ 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);