commit 47092d87b2460288186c05ccdede24b24aeeb52c
Author: Erez Zadok <[EMAIL PROTECTED]>
Date: Sun Dec 2 11:47:04 2007 -0500
Unionfs ODF: properly update parent dir times after rmdir/unlink
Comply with our time-based cache-coherency invariants: that the mtime of a
unionfs object is the max() of all lower ones.
diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c
index b1032a2..4619930 100644
--- a/fs/unionfs/unlink.c
+++ b/fs/unionfs/unlink.c
@@ -24,7 +24,6 @@ static int unionfs_do_unlink(struct inode *dir, struct dentry
*dentry)
struct dentry *lower_dir_dentry;
int bstart, bend, bindex;
int err = 0;
- struct iattr attr;
int opaque;
opaque = odf_get_opaque(dentry->d_parent);
@@ -55,7 +54,6 @@ static int unionfs_do_unlink(struct inode *dir, struct dentry
*dentry)
if (!err)
unionfs_copy_attr_times(dentry->d_inode);
dput(lower_dentry);
- fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
unlock_dir(lower_dir_dentry);
if (err)
@@ -72,15 +70,12 @@ static int unionfs_do_unlink(struct inode *dir, struct
dentry *dentry)
}
/*
- * we want to update mtime here, since if the file to
- * be removed was only on a rd only branch, then since
- * the mtime of that branch has not changed, so the
- * mtime of the upper file is not updated
+ * XXX: do we want to update mtime here? (since if the file to be
+ * removed was only on a rd only branch, then since the mtime of
+ * that branch has not changed, so the mtime of the upper file is
+ * not updated?)
*/
odf_purge_dir_cache(dentry->d_parent);
- attr.ia_mtime = current_kernel_time();
- attr.ia_valid = ATTR_MTIME | ATTR_MTIME_SET | ATTR_FORCE;
- err = notify_change(dentry->d_parent, &attr);
/*
* XXX: ignore this error, for now, unionfs_setattr should
@@ -130,17 +125,14 @@ int unionfs_unlink(struct inode *dir, struct dentry
*dentry)
if (!S_ISDIR(dentry->d_inode->i_mode))
unionfs_postcopyup_release(dentry);
d_drop(dentry);
- /*
- * if unlink/whiteout succeeded, parent dir mtime has
- * changed
- */
- unionfs_copy_attr_times(dir);
}
out:
if (!err) {
unionfs_check_dentry(dentry);
unionfs_check_inode(dir);
+ /* update parent dir times if unlink/whiteout succeeded */
+ unionfs_copy_attr_times(dir);
}
unionfs_unlock_dentry(dentry);
unionfs_read_unlock(dentry->d_sb);
@@ -153,7 +145,6 @@ static int unionfs_do_rmdir(struct inode *dir, struct
dentry *dentry)
struct dentry *lower_dir_dentry = NULL;
int bstart, bend, bindex;
int err = 0;
- struct iattr attr;
err = unionfs_partial_lookup(dentry);
if (err)
@@ -178,7 +169,6 @@ static int unionfs_do_rmdir(struct inode *dir, struct
dentry *dentry)
else
err = -EROFS;
dput(lower_dentry);
- fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
/* propagate number of hard-links */
/* FIXME: does this belong in or out of the loop? */
@@ -202,15 +192,12 @@ static int unionfs_do_rmdir(struct inode *dir, struct
dentry *dentry)
}
/*
- * we want to update mtime here, since if the file to
- * be removed was only on a rd only branch, then since
- * the mtime of that branch has not changed, so the
- * mtime of the upper file is not updated
+ * XXX: do we want to update mtime here? (since if the file to be
+ * removed was only on a rd only branch, then since the mtime of
+ * that branch has not changed, so the mtime of the upper file is
+ * not updated?)
*/
odf_purge_dir_cache(dentry->d_parent);
- attr.ia_mtime = current_kernel_time();
- attr.ia_valid = ATTR_MTIME | ATTR_MTIME_SET | ATTR_FORCE;
- err = notify_change(dentry->d_parent, &attr);
/*
* XXX: ignore this error, for now, unionfs_setattr should
@@ -250,6 +237,9 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
err = unionfs_do_rmdir(dir, dentry);
if (err)
goto out;
+ /* update parent dir times if if rmdir/whiteout succeeded above */
+ unionfs_copy_attr_times(dir);
+
/* FIXME: what if this fails? */
err = odf_remove(dentry, ODF_RMV_NOTWH);
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs