Skip to contentSkip to conversation

Intermezzo should call vfs_permission

PATCH In review Matthew Wilcox 3 participants 3 messages Oct 31, 2003 – Nov 11, 2003 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Intermezzo should call vfs_permission

This patch fixes some extremely naughty behaviour by intermezzo where it overrides a member of an inode's i_op -- which is probably shared between all inodes of that filesystem type! It turns out that the intended behaviour is accomplished equally well by just calling vfs_permission().

Index: fs/intermezzo/dir.c
===================================================================
RCS file: /var/cvs/linux-2.6/fs/intermezzo/dir.c,v retrieving revision 1.12

fs/intermezzo/dir.c +2 -13
diff -u -p -r1.12 dir.c
@@ -835,10 +835,9 @@ int presto_permission(struct inode *inod
 {
         unsigned short mode = inode->i_mode;
         struct presto_cache *cache;
-        int rc;
 
         ENTRY;
-        if ( presto_can_ilookup() && !(mask & S_IWOTH)) {
+        if (presto_can_ilookup() && !(mask & S_IWOTH)) {
                 CDEBUG(D_CACHE, "ilookup on %ld OK\n", inode->i_ino);
                 EXIT;
                 return 0;
@@ -861,18 +860,8 @@ int presto_permission(struct inode *inod
                 }
         }
 
-        /* The cache filesystem doesn't have its own permission function,
-         * but we don't want to duplicate the VFS code here.  In order
-         * to avoid looping from permission calling this function again,
-         * we temporarily override the permission operation while we call
-         * the VFS permission function.
-         */
-        inode->i_op->permission = NULL;
-        rc = permission(inode, mask, nd);
-        inode->i_op->permission = &presto_permission;
-
         EXIT;
-        return rc;
+        return vfs_permission(inode, mask);
 }
 
 
Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
#1 lore raw

What calls setattr?

I'm trying to test a change to setattr in YAFFS. In particular, I'm trying to test the use of ATTR_SIZE when the size of the file is reduced

I can't find the process-space system call that causes this to be called.(eg. file is 2kB and I want to cut it back to 1kB).

Help me plz.

Thanx

-- CHarles

#2 lore raw

Re: What calls setattr?

Quoted 7 lines · Charles Manning

I'm trying to test a change to setattr in YAFFS. In particular, I'm trying to test the use of ATTR_SIZE when the size of the file is reduced

I can't find the process-space system call that causes this to be called.(eg. file is 2kB and I want to cut it back to 1kB).

Help me plz.

man truncate

(plus a bunch of related syscalls, plus truncation-to-zero when you do open() with O_TRUNC, plus nfsd handling corresponding requests...)