Marcin Prejsnar:
> Yes. Look at this test. I used normal file loop-mounted. See attached scrip=
> t.

Probably this patch will help you.

Junjiro Okajima

--- unionfs-20060221-0341/inode.c       23 Feb 2006 00:47:37 -0000      1.1
+++ unionfs-20060221-0341/inode.c       27 Feb 2006 21:43:04 -0000      1.3
@@ -878,7 +899,8 @@ static int unionfs_permission(struct ino
        struct inode *hidden_inode = NULL;
        int err = 0;
        int bindex, bstart, bend;
-       int is_file = 0;
+       const int is_file = !S_ISDIR(inode->i_mode);
+       const int write_mask = (mask & MAY_WRITE) && !(mask & MAY_READ);
 
        print_entry_location();
 
@@ -887,10 +909,6 @@ static int unionfs_permission(struct ino
 
        fist_print_inode("IN unionfs_permission", inode);
 
-       /* set if check is for file */
-       if (!S_ISDIR(inode->i_mode))
-               is_file = 1;
-
        for (bindex = bstart; bindex <= bend; bindex++) {
                hidden_inode = itohi_index(inode, bindex);
                if (!hidden_inode)
@@ -900,7 +918,7 @@ static int unionfs_permission(struct ino
                 * we dont have to check for files, if we are checking for
                 * directories.
                 */
-               if (!S_ISDIR(hidden_inode->i_mode) && (!is_file))
+               if (!is_file && !S_ISDIR(hidden_inode->i_mode))
                        continue;
                /* We use our own special version of permission, such that 
                 * only the first branch returns -EROFS. */
@@ -910,12 +928,11 @@ static int unionfs_permission(struct ino
                if (err)
                        goto out;
                /* only the leftmost file matters. */
-               if (is_file) {
-                       if (mask & MAY_WRITE) {
+               if (is_file || write_mask) {
+                       if (is_file && write_mask) {
                                err = get_write_access(hidden_inode);
-                               if (err)
-                                       goto out;
-                               put_write_access(hidden_inode);
+                               if (!err)
+                                       put_write_access(hidden_inode);
                        }
                        break;
                }
_______________________________________________
unionfs mailing list
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs

Reply via email to