Hello all.
I have tested regression/open-unlink.sh in DELETE_WHITEOUT mode, and it
crashed. I think it is a bug of unionfs_file_revalidate().
here is a patch.
Creating a whiteout by rename(2) is not a good idea. If the file is
opened, we can unlink it safely. It doesn't affect later read and write
to the file since the inode is still living by its ref count.
Junjiro Okajima
diff -u -p -r1.1 -r1.2
--- unionfs-20060117-2031/commonfops.c 18 Jan 2006 03:02:19 -0000 1.1
+++ unionfs-20060117-2031/commonfops.c 18 Jan 2006 05:58:28 -0000 1.2
@@ -300,7 +300,8 @@ int unionfs_file_revalidate(struct file
/* Copyup on the first write to a file on a readonly branch. */
if (willwrite && IS_WRITE_FLAG(file->f_flags)
- && !IS_WRITE_FLAG(ftohf(file)->f_flags) && is_robranch(dentry)) {
+ && !IS_WRITE_FLAG(ftohf(file)->f_flags)
+ && (d_deleted(dentry) || is_robranch(dentry))) {
fist_dprint(3,
"Doing delayed copyup of a read-write file on a
read-only branch.\n");
bstart = fbstart(file);
diff -u -p -r1.1 -r1.4
--- unionfs-20060117-2031/regression/open-unlink.sh 18 Jan 2006 03:02:19
-0000 1.1
+++ unionfs-20060117-2031/regression/open-unlink.sh 18 Jan 2006 06:08:15
-0000 1.4
@@ -33,10 +33,25 @@ FILES
}
+f() # delete_mode rw_ro
+{
+echo $1 $2
( files ) | create_hierarchy
-mount_union "" $LOWER_DIR/b0 $LOWER_DIR/b1=ro
+mount_union "delete=$1" $LOWER_DIR/b0 $LOWER_DIR/b1=$2
./progs/open-unlink $MOUNTPOINT/a
unmount_union
-( afterfiles_ro ) | check_hierarchy $LOWER_DIR
+if [ "$2" == "rw" ]
+then
+ ( afterfiles_rw ) | check_hierarchy $LOWER_DIR || :
+else
+ ( afterfiles_ro ) | check_hierarchy $LOWER_DIR
+fi
+}
+for i in all whiteout
+do
+ for j in ro rw
+ do f $i $j
+ done
+done
complete_test
_______________________________________________
unionfs mailing list
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs