Martin Walter:
> sorry, I still have a permission problem with 2.6.13-15-smp +
> unionfs-20051013-1721 ;-(
>
> The touch command seems to open a file with O_WRONLY and fails
> but then it does utimes("file",0).
Permission problems are headachy to us. Your bug reports lead us ahead.
open(O_WRONLY) should success, but actually failed.
nfs_permission(MAY_WRITE) alwasy returns OK when the entry is a dir, but
a file. When the entry is a file, nfs_permission(MAY_WRITE) asks the nfs
server it is writable or not. And your nfs server returns EACCES since
the filesystem is exported as readonly. (sorry, i was confused the name
of EACCES and EPERM)
Probably unionfs_permission() should call generic_permission() instead
of inode->i_op->permission() when the branch is not leftmost. But it may
not be perfect since the real permission check is done by
inode->i_op->permission() when it is implemented. If the filesystem have
some special featrues around the permission or attribute and
i_op->permission() would check them, those check will be skipped.
Also less possibilities of generic_permission() does (will do) another
check are left.
Here is a patch which calls generic_permission() after nfs_permission()
failed. Still it is not good solution, better than now a little bit.
Junjiro Okajima
--- unionfs-20051013-1721/inode.c 2005-10-14 06:21:24.000000000 +0900
+++ inode.c 2005-10-16 19:08:39.000000000 +0900
@@ -825,7 +825,7 @@
}
/* Basically copied from the kernel vfs permission() -KK */
-int inode_permission(struct inode *inode, int mask, struct nameidata *nd)
+static int inode_permission(struct inode *inode, int mask, struct nameidata
*nd)
{
int retval, submask;
@@ -850,9 +850,21 @@
/* Ordinary permission routines do not understand MAY_APPEND. */
submask = mask & ~MAY_APPEND;
- if (inode->i_op && inode->i_op->permission)
+ retval = 1;
+#define IS_NFS(inode) (strncmp("nfs", (inode)->i_sb->s_type->name, 4) == 0)
+ if (inode->i_op && inode->i_op->permission) {
retval = inode->i_op->permission(inode, submask, nd);
- else
+ /*
+ * when the branch is not leftmost, we will copyup it later.
+ * so we may ignore the error of 'nfs exported as readonly.'
+ * This part depends on the filesystem, too bad.
+ */
+ ASSERT(retval <= 0);
+ if (retval == -EACCES && (submask & MAY_WRITE)
+ && IS_NFS(inode))
+ retval = 1;
+ }
+ if (retval > 0)
retval = generic_permission(inode, submask, NULL);
if (retval)
return retval;
_______________________________________________
unionfs mailing list
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs