]> git.proxmox.com Git - mirror_spl-debian.git/blobdiff - module/spl/spl-vnode.c
New upstream version 0.7.2
[mirror_spl-debian.git] / module / spl / spl-vnode.c
index e3188a1af8b091523402f0a28b66d6abda59e85e..346e63c0f1613a4af068338595db08de59fdc439 100644 (file)
@@ -63,9 +63,6 @@ vn_mode_to_vtype(mode_t mode)
        if (S_ISSOCK(mode))
                return VSOCK;
 
-       if (S_ISCHR(mode))
-               return VCHR;
-
        return VNON;
 } /* vn_mode_to_vtype() */
 EXPORT_SYMBOL(vn_mode_to_vtype);
@@ -224,7 +221,6 @@ vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off,
        ASSERT(vp->v_file);
        ASSERT(seg == UIO_SYSSPACE);
        ASSERT((ioflag & ~FAPPEND) == 0);
-       ASSERT(x2 == RLIM64_INFINITY);
 
        fp = vp->v_file;
 
@@ -677,6 +673,19 @@ vn_getf(int fd)
 
        fp = file_find(fd, current);
        if (fp) {
+               lfp = fget(fd);
+               fput(fp->f_file);
+               /*
+                * areleasef() can cause us to see a stale reference when
+                * userspace has reused a file descriptor before areleasef()
+                * has run. fput() the stale reference and replace it. We
+                * retain the original reference count such that the concurrent
+                * areleasef() will decrement its reference and terminate.
+                */
+               if (lfp != fp->f_file) {
+                       fp->f_file = lfp;
+                       fp->f_vnode->v_file = lfp;
+               }
                atomic_inc(&fp->f_ref);
                spin_unlock(&vn_file_lock);
                return (fp);