cleanups
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 9 Nov 2004 17:30:29 +0000 (17:30 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Tue, 9 Nov 2004 17:30:29 +0000 (17:30 +0000)
kernel/dev.c
kernel/dir.c

index 2e081d00ab8e0101fb697d4a0395a6bc5f9316ef..71d306a7283be8d0de9658a73693d9e134b089f5 100644 (file)
@@ -78,12 +78,14 @@ static void request_wait_answer(struct fuse_req *req, int interruptible)
                return;
 
        /* Request interrupted... Wait for it to be unlocked */
-       if (req->locked) {
+       while (req->locked) {
                req->interrupted = 1;
                spin_unlock(&fuse_lock);
                wait_event(req->waitq, !req->locked);
                spin_lock(&fuse_lock);
        }
+       if (req->finished)
+               return;
        
        /* Operations which modify the filesystem cannot safely be
           restarted, because it is uncertain whether the operation has
index ce6df5ddd779c3ea489fa88630207c107234d4d6..a2fe6a807195b7fb8c189fba098c8b919ef370bc 100644 (file)
@@ -73,12 +73,17 @@ static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr)
                inode->i_op = &fuse_symlink_inode_operations;
        }
        else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) || 
-                S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)){
+                S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
                inode->i_op = &fuse_file_inode_operations;
                init_special_inode(inode, inode->i_mode,
                                   new_decode_dev(attr->rdev));
-       } else
+       } else {
+               /* Don't let user create weird files */
                printk("fuse_init_inode: bad file type: %o\n", inode->i_mode);
+               inode->i_mode = S_IFREG;
+               inode->i_op = &fuse_file_inode_operations;
+               fuse_init_file_inode(inode);
+       }
 }
 
 #ifdef KERNEL_2_6
@@ -283,7 +288,7 @@ static int lookup_new_entry(struct fuse_conn *fc, struct fuse_req *req,
        if ((inode->i_mode ^ mode) & S_IFMT) {
                iput(inode);
                printk("fuse_mknod: inode has wrong type\n");
-               return -EINVAL;
+               return -EPROTO;
        }
 
        entry->d_time = time_to_jiffies(outarg->entry_valid,
@@ -609,7 +614,7 @@ static int _fuse_permission(struct inode *inode, int mask)
 
                /* FIXME: Need some mechanism to revoke permissions:
                   currently if the filesystem suddenly changes the
-                  file mode, we will not be informed abot that, and
+                  file mode, we will not be informed about it, and
                   continue to allow access to the file/directory.
                   
                   This is actually not so grave, since the user can
@@ -854,7 +859,6 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
                        send_sig(SIGXFSZ, current, 0);
                        return -EFBIG;
                }
-               //fuse_sync_inode(inode);
        }
 
        req = fuse_get_request(fc);