From: Erez Zadok Date: Tue, 13 Jan 2009 04:03:36 +0000 (-0500) Subject: Unionfs: handle partial copyup errors gracefully X-Git-Tag: unionfs-2.5.1~4 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=70da80c0c4e8d4f55d485c70cb35b5924387a5ed;p=unionfs-2.6.25.y.git Unionfs: handle partial copyup errors gracefully Don't leave any dentries behind if copying up the inode (or setting its permission, i.e., using TOMOYO) failed. CC: Tetsuo Handa Signed-off-by: Erez Zadok --- diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c index bbd49c83b0e..0254b60d641 100644 --- a/fs/unionfs/copyup.c +++ b/fs/unionfs/copyup.c @@ -519,8 +519,17 @@ out_free: dput(old_lower_dentry); kfree(symbuf); - if (err) + if (err) { + /* + * if directory creation succeeded, but inode copyup failed, + * then purge new dentries. + */ + if (dbstart(dentry) < old_bstart && + ibstart(dentry->d_inode) > dbstart(dentry)) + __clear(dentry, NULL, old_bstart, old_bend, + unionfs_lower_dentry(dentry), dbstart(dentry)); goto out; + } if (!S_ISDIR(dentry->d_inode->i_mode)) { unionfs_postcopyup_release(dentry); if (!unionfs_lower_inode(dentry->d_inode)) {