[PVFS2-users] Files and directory not accessible with some
commands
Ekow Otoo
ekw at hpcrd.lbl.gov
Wed Oct 26 10:57:49 EDT 2005
Hi,
I have four patches in this order.
1) src/server/pvfs2-server.h
2) src/kernel/linux-2.6/acl.c:1.5->1.6
3) dist-time.patch affecting
pvfs2/include/pvfs2-util.h
pvfs2/src/apps/kernel/linux/pvfs2-client-core.c
pvfs2/src/client/sysint/acache.c
pvfs2/src/client/sysint/sys-getattr.c
pvfs2/src/client/sysint/sys-lookup.c
pvfs2/src/common/misc/pint-util.c
4) perms.patch affecting
src/kernel/linux-2.6/acl.c
src/kernel/linux-2.6/devpvfs2-req.c
src/kernel/linux-2.6/file.c
src/kernel/linux-2.6/pvfs2-kernel.h
src/kernel/linux-2.6/pvfs2-utils.c
The first I can apply and is independent of the others.
Could you tell me if I should apply (2, 3 and 4 in order) or (3 and then 4)
or only 4 after the first one to the original pvfs2-1.3.0 source.
---Ekow
==============================================================
Murali Vilayannur wrote:
>Hi Ekow,
>Could you try the attached patch to see if it fixes your permission error
>problems?
>It was basically breakage introduced by me due to the recent acl merges.
>Hopefully, this patch will address that for good.
>It should also fix some compiler warnings (on x86_64 boxes)...
>Thanks,
>Murali
>
>
>On Mon, 24 Oct 2005, Ekow Otoo wrote:
>
>
>
>>Hi Rob,
>>
>>I have setup a new pvfs2 installation from scratch with pvfs2-1.3.0 on
>>just two machines.
>>All previous space, directory were whipped clean and recreated. Yet I
>>still run into the
>>problem of "permission denied" when running some commands.
>>As a user I can create a directory but cannot cd into it. I cannot copy
>>files into new directories either.
>>I can copy a file into the /mnt/pvfs2 but I cannot display the content
>>of the file.
>>All commands work fine only if I am root. Is there some setting "eg.
>>umask" that I should have ?
>>My Linux installation is "Linux version 2.6.9-22.EL
>>(buildcentos at louisa.home.local) (gcc version 3.4.4 20050721 (Red Hat
>>3.4.4-2)) #1 Sat Oct 8 17:48:27 CDT 2005"
>>A sample session is shown below:
>>--------------------------------------------------------------------------------------------
>>[ekw at ekow pvfs2]$ pwd
>>/mnt/pvfs2
>>[ekw at ekow pvfs2]$ pvfs2-ls
>>TestDir
>>lost+found
>>[ekw at ekow pvfs2]$ ls -alF
>>total 20
>>drwxrwxrwx 1 root root 4096 Oct 24 13:48 ./
>>drwxr-xr-x 3 root root 4096 Oct 24 13:22 ../
>>drwxrwxrwx 1 root root 4096 Oct 24 13:30 lost+found/
>>drwxrwxr-x 1 ekw ekw 4096 Oct 24 13:46 TestDir/
>>[ekw at ekow pvfs2]$ mkdir TT
>>[ekw at ekow pvfs2]$ cd TT
>>bash: cd: TT: Permission denied
>>[ekw at ekow pvfs2]$ pvfs2-ls TT
>>[ekw at ekow pvfs2]$ cp ~ekw/test.cc .
>>[ekw at ekow pvfs2]$ ls -al
>>total 28
>>drwxrwxrwx 1 root root 4096 Oct 24 13:48 .
>>drwxr-xr-x 3 root root 4096 Oct 24 13:22 ..
>>drwxrwxrwx 1 root root 4096 Oct 24 13:30 lost+found
>>-rw-rw-r-- 1 ekw ekw 112 Jan 2 1970 test.cc
>>drwxrwxr-x 1 ekw ekw 4096 Oct 24 13:46 TestDir
>>drwxrwxr-x 1 ekw ekw 4096 Oct 24 14:09 TT
>>[ekw at ekow pvfs2]$ cat test.cc
>>cat: test.cc: Permission denied
>>[ekw at ekow pvfs2]$ ls TT
>>ls: TT: Permission denied
>>[ekw at ekow pvfs2]$ pvfs2-ls TT
>>[ekw at ekow pvfs2]$
>>-------------------------------------------------------------------------------------
>>Note also that the timestamp on file "test.cc" copied into /mnt/pvfs2 is
>>wrong.
>>This was mentioned in the email of "Number Cruncher." The timestamp
>>error and the
>>"permission denied" error could be related. Has any one a solution yet ?
>>---Ekow
>>
>>_______________________________________________
>>PVFS2-users mailing list
>>PVFS2-users at beowulf-underground.org
>>http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users
>>
>>
>>
>>
>
>------------------------------------------------------------------------
>
>Index: src/kernel/linux-2.6/acl.c
>===================================================================
>RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/acl.c,v
>retrieving revision 1.6
>diff -u -r1.6 acl.c
>--- src/kernel/linux-2.6/acl.c 18 Oct 2005 16:29:48 -0000 1.6
>+++ src/kernel/linux-2.6/acl.c 25 Oct 2005 23:02:26 -0000
>@@ -59,7 +59,7 @@
> if (size < 0 || (size % sizeof(pvfs2_acl_entry)) != 0)
> {
> pvfs2_error("pvfs2_acl_decode: Invalid value of size %d [should be a multiple of %d]\n",
>- size, sizeof(pvfs2_acl_entry));
>+ (int) size, (int) sizeof(pvfs2_acl_entry));
> return ERR_PTR(-EINVAL);
> }
> count = size / sizeof(pvfs2_acl_entry);
>@@ -129,7 +129,7 @@
> if (!e)
> {
> pvfs2_error("pvfs2_acl_encode: Could not allocate %d bytes for acl encode\n",
>- *size);
>+ (int) *size);
> return ERR_PTR(-ENOMEM);
> }
> ptr = e;
>@@ -536,39 +536,67 @@
> #ifdef HAVE_GENERIC_PERMISSION
> return generic_permission(inode, mask, pvfs2_check_acl);
> #else
>- /* We sort of duplicate the code below from generic_permission */
>+ /* We sort of duplicate the code below from generic_permission. */
> int mode = inode->i_mode;
> int error;
>+
>+ pvfs2_print("pvfs2_permission: mask = %x mode = %x current->fsuid = %x, inode->i_uid = %x\n",
>+ mask, mode, current->fsuid, inode->i_uid);
>+
> /* No write access on a rdonly FS */
> if ((mask & MAY_WRITE) && IS_RDONLY(inode) &&
> (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
>+ {
>+ pvfs2_print("pvfs2_permission: cannot write to a read-only-file-system!\n");
> return -EROFS;
>+ }
> /* No write access to any immutable files */
>- if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode))
>+ if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode))
>+ {
>+ pvfs2_error("pvfs2_permission: cannot write to an immutable file!\n");
> return -EACCES;
>- if (current->fsuid == inode->i_uid) {
>- mode >>= 6;
> }
>- else if (get_acl_flag(inode) == 1) {
>- /*
>- * Access ACL won't work if we don't have group permission bits
>- * set on the file!
>- */
>- if (((mode >> 3) & mask & S_IRWXO) != mask)
>- goto check_groups;
>- error = pvfs2_check_acl(inode, mask);
>- /* ACL disallows access */
>- if (error == -EACCES)
>- goto check_capabilities;
>- /* No ACLs present? */
>- else if (error == -EAGAIN)
>- goto check_groups;
>- /* Any other error */
>- return error;
>+ /* Do permission checks only for lookups and opens */
>+ if (!nd || !(nd->flags & (LOOKUP_OPEN | LOOKUP_ACCESS)))
>+ {
>+ return 0;
>+ }
>+ if (current->fsuid == inode->i_uid)
>+ {
>+ mode >>= 6;
> }
>+ else
>+ {
>+ if (get_acl_flag(inode) == 1)
>+ {
>+ /*
>+ * Access ACL won't work if we don't have group permission bits
>+ * set on the file!
>+ */
>+ if (((mode >> 3) & mask & S_IRWXO) != mask)
>+ {
>+ goto check_groups;
>+ }
>+ error = pvfs2_check_acl(inode, mask);
>+ /* ACL disallows access */
>+ if (error == -EACCES)
>+ {
>+ pvfs2_print("pvfs2_permission: acl disallowing access to file\n");
>+ goto check_capabilities;
>+ }
>+ /* No ACLs present? */
>+ else if (error == -EAGAIN)
>+ {
>+ goto check_groups;
>+ }
>+ /* Any other error */
>+ return error;
>+ }
> check_groups:
>- if (in_group_p(inode->i_gid))
>- mode >>= 3;
>+ if (in_group_p(inode->i_gid))
>+ mode >>= 3;
>+ }
>+ pvfs2_print("pvfs2_permission: mode & mask & S_IRWXO = %d, mask = %d\n", mode & mask & S_IRWXO, mask);
> if ((mode & mask & S_IRWXO) == mask)
> return 0;
> check_capabilities:
>@@ -584,6 +612,7 @@
> {
> return 0;
> }
>+ pvfs2_print("pvfs2_permission: disallowing access\n");
> return -EACCES;
> #endif
> }
>Index: src/kernel/linux-2.6/devpvfs2-req.c
>===================================================================
>RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/devpvfs2-req.c,v
>retrieving revision 1.52
>diff -u -r1.52 devpvfs2-req.c
>--- src/kernel/linux-2.6/devpvfs2-req.c 19 Oct 2005 20:58:35 -0000 1.52
>+++ src/kernel/linux-2.6/devpvfs2-req.c 25 Oct 2005 23:02:26 -0000
>@@ -387,7 +387,7 @@
> {
> pvfs2_print("WARNING: pvfs2_iocb from op"
> "has invalid fields! %p, %p(%p), %d\n",
>- x->buffer, x->op, op, x->bytes_to_be_copied);
>+ x->buffer, x->op, op, (int) x->bytes_to_be_copied);
> }
> else
> {
>Index: src/kernel/linux-2.6/file.c
>===================================================================
>RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/file.c,v
>retrieving revision 1.98
>diff -u -r1.98 file.c
>--- src/kernel/linux-2.6/file.c 19 Oct 2005 20:58:35 -0000 1.98
>+++ src/kernel/linux-2.6/file.c 25 Oct 2005 23:02:26 -0000
>@@ -629,7 +629,7 @@
> to_free = 0;
> }
> ptr = iovecptr;
>- pvfs2_print("pvfs2_file_readv reading %d@%Lu\n", count, *offset);
>+ pvfs2_print("pvfs2_file_readv reading %d@%Lu\n", (int) count, Ld(*offset));
> pvfs2_print("pvfs2_file_readv: new_nr_segs: %lu, seg_count: %u\n",
> new_nr_segs, seg_count);
> for (seg = 0; seg < new_nr_segs; seg++)
>@@ -637,7 +637,7 @@
> pvfs2_print("pvfs2_file_readv: %d) %p to %p [%d bytes]\n",
> seg + 1, iovecptr[seg].iov_base,
> iovecptr[seg].iov_base + iovecptr[seg].iov_len,
>- iovecptr[seg].iov_len);
>+ (int) iovecptr[seg].iov_len);
> }
> for (seg = 0; seg < seg_count; seg++)
> {
>@@ -729,7 +729,7 @@
> return ret;
> }
> pvfs2_print("pvfs2_file_readv nr_segs %u, offset: %Lu each_count:%d\n",
>- seg_array[seg], *offset, each_count);
>+ (int) seg_array[seg], *offset, (int) each_count);
> /*
> * copy data to application by pushing it out to the iovec.
> * Number of segments to copy so that we don't
>@@ -884,7 +884,7 @@
> to_free = 0;
> }
> ptr = iovecptr;
>- pvfs2_print("pvfs2_file_writev writing %d@%Lu\n", count, *offset);
>+ pvfs2_print("pvfs2_file_writev writing %d@%Lu\n", (int) count, *offset);
> pvfs2_print("pvfs2_file_writev: new_nr_segs: %lu, seg_count: %u\n",
> new_nr_segs, seg_count);
> for (seg = 0; seg < new_nr_segs; seg++)
>@@ -892,7 +892,7 @@
> pvfs2_print("pvfs2_file_writev: %d) %p to %p [%d bytes]\n",
> seg + 1, iovecptr[seg].iov_base,
> iovecptr[seg].iov_base + iovecptr[seg].iov_len,
>- iovecptr[seg].iov_len);
>+ (int) iovecptr[seg].iov_len);
> }
> for (seg = 0; seg < seg_count; seg++)
> {
>@@ -939,7 +939,7 @@
> new_op->upcall.req.io.count = each_count;
> new_op->upcall.req.io.offset = *offset;
> pvfs2_print("pvfs2_file_writev nr_segs %u, offset: %Lu each_count: %d\n",
>- seg_array[seg], *offset, each_count);
>+ seg_array[seg], *offset, (int) each_count);
>
> /*
> * copy data from application by pulling it out of the iovec.
>@@ -1133,7 +1133,7 @@
> spin_unlock(&op->lock);
> pvfs2_print("pvfs2_aio_retry: buffer %p,"
> " size %d return %d bytes\n",
>- x->buffer, x->bytes_to_be_copied, error);
>+ x->buffer, (int) x->bytes_to_be_copied, (int) error);
> if ((x->rw == PVFS_IO_WRITE) && error > 0)
> {
> struct inode *inode = iocb->ki_filp->f_mapping->host;
>@@ -1430,7 +1430,7 @@
> {
> pvfs2_error("aio_read: cannot transfer (%d) bytes"
> " (larger than block size %d)\n",
>- count, pvfs_bufmap_size_query());
>+ (int) count, pvfs_bufmap_size_query());
> return -EINVAL;
> }
> filp = iocb->ki_filp;
>@@ -1472,7 +1472,7 @@
> if (error < 0)
> {
> pvfs2_error("pvfs2_file_aio_read: pvfs_bufmap_get() "
>- " failure %d\n", ret);
>+ " failure %d\n", (int) ret);
> /* drop ref count and possibly de-allocate */
> put_op(new_op);
> goto out_error;
>@@ -1535,7 +1535,7 @@
> if ((error_exit != 0) && (ret == -EINTR))
> {
> pvfs2_print("pvfs2_file_aio_read: returning error %d "
>- "(error_exit=%d)\n", ret, error_exit);
>+ "(error_exit=%d)\n", (int) ret, error_exit);
> }
> else
> {
>@@ -1545,7 +1545,7 @@
> "\n -- downcall status is %d, returning %d "
> "(error_exit=%d)\n",
> Lu(pvfs2_ino_to_handle(inode->i_ino)),
>- dc_status, ret, error_exit);
>+ dc_status, (int) ret, error_exit);
> }
> error = ret;
> goto out_error;
>@@ -1559,7 +1559,7 @@
> }
> if (ret)
> {
>- pvfs2_print("Failed to copy user buffer %d\n", ret);
>+ pvfs2_print("Failed to copy user buffer %d\n", (int) ret);
> new_op->downcall.status = -PVFS_EFAULT;
> /* error is set in the goto target */
> goto error_exit;
>@@ -1600,7 +1600,7 @@
> service_async_vfs_op(new_op);
> pvfs2_print("pvfs2_file_aio_read: queued "
> " read operation [%ld for %d]\n",
>- (unsigned long) offset, count);
>+ (unsigned long) offset, (int) count);
> error = -EIOCBQUEUED;
> /*
> * All cleanups done upon completion
>@@ -1686,7 +1686,7 @@
> {
> pvfs2_error("aio_write: cannot transfer (%d) bytes"
> " (larger than block size %d)\n",
>- count, pvfs_bufmap_size_query());
>+ (int) count, pvfs_bufmap_size_query());
> return -EINVAL;
> }
> error = -EINVAL;
>@@ -1725,7 +1725,7 @@
> if (error < 0)
> {
> pvfs2_error("pvfs2_file_aio_write: pvfs_bufmap_get()"
>- " failure %d\n", ret);
>+ " failure %d\n", (int) ret);
> /* drop ref count and possibly de-allocate */
> put_op(new_op);
> goto out_error;
>@@ -1746,7 +1746,7 @@
> buffer_index, current_buf, count);
> if (error < 0)
> {
>- pvfs2_print("Failed to copy user buffer %d\n", ret);
>+ pvfs2_print("Failed to copy user buffer %d\n", (int) ret);
> /* drop the buffer index */
> pvfs_bufmap_put(buffer_index);
> pvfs2_print("pvfs2_file_aio_read: pvfs_bufmap_put %d\n",
>@@ -1809,7 +1809,7 @@
> if ((error_exit != 0) && (ret == -EINTR))
> {
> pvfs2_print("pvfs2_file_aio_write: returning error %d "
>- "(error_exit=%d)\n", ret, error_exit);
>+ "(error_exit=%d)\n", (int) ret, error_exit);
> }
> else
> {
>@@ -1823,7 +1823,7 @@
> (filp && filp->f_dentry
> && filp->f_dentry->d_name.name ?
> (char *)filp->f_dentry->d_name.name : "UNKNOWN"),
>- dc_status, ret, error_exit);
>+ dc_status, (int) ret, error_exit);
> }
> error = ret;
> goto out_error;
>@@ -1832,7 +1832,7 @@
> wake_up_device_for_return(new_op);
> pvfs_bufmap_put(buffer_index);
> pvfs2_print("pvfs2_file_aio_read: pvfs_bufmap_put %d\n",
>- buffer_index);
>+ (int) buffer_index);
> if (error > 0)
> {
> update_atime(inode);
>@@ -1868,7 +1868,7 @@
> service_async_vfs_op(new_op);
> pvfs2_print("pvfs2_file_aio_write: queued "
> " write operation [%ld for %d]\n",
>- (unsigned long) offset, count);
>+ (unsigned long) offset, (int) count);
> error = -EIOCBQUEUED;
> /*
> * All cleanups done upon completion
>Index: src/kernel/linux-2.6/pvfs2-kernel.h
>===================================================================
>RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/pvfs2-kernel.h,v
>retrieving revision 1.103
>diff -u -r1.103 pvfs2-kernel.h
>--- src/kernel/linux-2.6/pvfs2-kernel.h 19 Oct 2005 20:58:35 -0000 1.103
>+++ src/kernel/linux-2.6/pvfs2-kernel.h 25 Oct 2005 23:02:26 -0000
>@@ -674,12 +674,12 @@
> if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
> { \
> ret = (etime ? etime : -EINVAL); \
>- pvfs2_print("OP timed out. Returning %d\n", ret); \
>+ pvfs2_print("OP timed out. Returning %d\n", (int)ret); \
> } \
> else if (ret == PVFS2_WAIT_SIGNAL_RECVD) \
> { \
> ret = (esig ? esig : -EINTR); \
>- pvfs2_print("OP interrupted. Returning %d\n", ret); \
>+ pvfs2_print("OP interrupted. Returning %d\n", (int)ret); \
> } \
> } while(0)
>
>@@ -697,7 +697,7 @@
> if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
> { \
> pvfs2_error("%s -- wait timed out (%x). " \
>- "aborting attempt.\n", method, ret); \
>+ "aborting attempt.\n", method, (int)ret); \
> } \
> goto error_exit; \
> } \
>@@ -714,7 +714,7 @@
> if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
> { \
> pvfs2_error("pvfs2_op_cancel: wait timed out " \
>- "(%x). aborting attempt.\n", ret); \
>+ "(%x). aborting attempt.\n", (int)ret); \
> } \
> goto error_exit; \
> } \
>@@ -732,7 +732,7 @@
> if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
> { \
> pvfs2_error("%s -- wait timed out (%x). " \
>- "aborting attempt.\n", method,ret); \
>+ "aborting attempt.\n", method,(int)ret); \
> } \
> goto error_exit; \
> } \
>@@ -763,7 +763,7 @@
> if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
> { \
> pvfs2_error("%s -- wait timed out (%x). aborting "\
>- "retry attempts.\n", method, ret); \
>+ "retry attempts.\n", method, (int) ret); \
> } \
> goto error_exit; \
> } \
>@@ -807,7 +807,7 @@
> if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
> { \
> pvfs2_error("%s -- wait timed out (%x). aborting " \
>- " retry attempts.\n", meth, ret); \
>+ " retry attempts.\n", meth, (int)ret); \
> } \
> e = 1; \
> goto error_exit; \
>Index: src/kernel/linux-2.6/pvfs2-utils.c
>===================================================================
>RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/pvfs2-utils.c,v
>retrieving revision 1.105
>diff -u -r1.105 pvfs2-utils.c
>--- src/kernel/linux-2.6/pvfs2-utils.c 11 Oct 2005 21:43:29 -0000 1.105
>+++ src/kernel/linux-2.6/pvfs2-utils.c 25 Oct 2005 23:02:26 -0000
>@@ -489,7 +489,7 @@
> if (size < 0 || strlen(name) >= PVFS_MAX_XATTR_NAMELEN)
> {
> pvfs2_error("Invalid size (%d) or key length (%d)\n",
>- size, strlen(name));
>+ (int) size, (int) strlen(name));
> return -EINVAL;
> }
> if (inode)
>@@ -516,7 +516,7 @@
> new_op->upcall.req.getxattr.key_sz =
> strlen(new_op->upcall.req.getxattr.key) + 1;
> pvfs2_print("pvfs2_inode_getxattr: key %s, key_sz %d\n",
>- name, new_op->upcall.req.getxattr.key_sz);
>+ name, (int) new_op->upcall.req.getxattr.key_sz);
>
> service_error_exit_op_with_timeout_retry(
> new_op, "pvfs2_inode_getxattr", retries, error_exit,
>@@ -553,7 +553,7 @@
> length - 1);
> ret = length - 1;
> pvfs2_print("pvfs2_getxattr: key: %s, val_length: %d\n",
>- name, ret);
>+ name, (int) ret);
> }
> }
> }
>@@ -561,7 +561,7 @@
> {
> ret = -ENODATA; /* if no such keys exists we set this to be errno */
> }
>- pvfs2_print("pvfs2_inode_getxattr: returning %d\n", ret);
>+ pvfs2_print("pvfs2_inode_getxattr: returning %d\n", (int) ret);
>
> /* when request is serviced properly, free req op struct */
> op_release(new_op);
>@@ -585,7 +585,7 @@
> if (size < 0 || size >= PVFS_MAX_XATTR_VALUELEN || flags < 0)
> {
> pvfs2_error("pvfs2_inode_setxattr: bogus values of size(%d), flags(%d)\n",
>- size, flags);
>+ (int) size, flags);
> return -EINVAL;
> }
> if (name == NULL || (size > 0 && value == NULL))
>@@ -596,7 +596,7 @@
> if (strlen(name) >= PVFS_MAX_XATTR_NAMELEN)
> {
> pvfs2_error("pvfs2_inode_setxattr: bogus key size (%d)\n",
>- strlen(name));
>+ (int) strlen(name));
> return -EINVAL;
> }
> /* This is equivalent to a removexattr */
>@@ -663,7 +663,7 @@
> if (strlen(name) >= PVFS_MAX_XATTR_NAMELEN)
> {
> pvfs2_error("pvfs2_inode_removexattr: Invalid key length(%d)\n",
>- strlen(name));
>+ (int) strlen(name));
> return -EINVAL;
> }
> if (inode)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.beowulf-underground.org/pipermail/pvfs2-users/attachments/20051026/b47a9a00/attachment-0001.htm
More information about the PVFS2-users
mailing list