lkml.org 
[lkml]   [2003]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patches in this message
    /
    Date
    From
    Subject[PATCH] NFS sillyrename fixes take 3
    On Wed, Jun 11, 2003 at 12:22:26AM -0700, Frank Cusack wrote:
    > so anyway, please find attached a 2.4.21-rc7 and 2.5.70 patch which
    > prevents removal or rename of unlinked-but-open files.

    Minor adjustment. It's functionally the same but prevents a spurious
    printk (fs/nfs/dir.c:1199 in 2.5.70).

    Works for me.

    /fc
    --- linux-2.4.21-rc7/fs/namei.c Sun Jun 8 23:57:33 2003
    +++ linux-2.4.21-rc7-silly/fs/namei.c Tue Jun 10 23:49:08 2003
    @@ -1482,13 +1482,14 @@ int vfs_unlink(struct inode *dir, struct
    lock_kernel();
    error = dir->i_op->unlink(dir, dentry);
    unlock_kernel();
    - if (!error)
    + if (!error &&
    + !(dentry->d_flags & DCACHE_NFSFS_RENAMED))
    d_delete(dentry);
    }
    }
    }
    up(&dir->i_zombie);
    - if (!error)
    + if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED))
    inode_dir_notify(dir, DN_DELETE);
    return error;
    }
    @@ -1830,6 +1831,11 @@ int vfs_rename(struct inode *old_dir, st
    struct inode *new_dir, struct dentry *new_dentry)
    {
    int error;
    +
    + if (old_dentry->d_flags & DCACHE_NFSFS_RENAMED ||
    + new_dentry->d_flags & DCACHE_NFSFS_RENAMED)
    + return -EBUSY;
    +
    if (S_ISDIR(old_dentry->d_inode->i_mode))
    error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry);
    else--- linux-2.5.70/fs/namei.c Sun Jun 1 23:30:30 2003
    +++ linux-2.5.70-silly/fs/namei.c Tue Jun 10 23:44:14 2003
    @@ -1631,7 +1631,9 @@ int vfs_unlink(struct inode *dir, struct
    error = dir->i_op->unlink(dir, dentry);
    }
    up(&dentry->d_inode->i_sem);
    - if (!error) {
    +
    + /* We don't d_delete() NFS sillyrenamed files--they still exist. */
    + if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
    d_delete(dentry);
    inode_dir_notify(dir, DN_DELETE);
    }
    @@ -1949,6 +1951,11 @@ int vfs_rename(struct inode *old_dir, st

    if (old_dentry->d_inode == new_dentry->d_inode)
    return 0;
    +
    + /* Don't allow sillyrenamed files to move; messes up async_unlink */
    + if (old_dentry->d_flags & DCACHE_NFSFS_RENAMED ||
    + new_dentry->d_flags & DCACHE_NFSFS_RENAMED)
    + return -EBUSY;

    error = may_delete(old_dir, old_dentry, is_dir);
    if (error)
    \
     
     \ /
      Last update: 2005-03-22 13:36    [W:0.024 / U:213.256 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site