]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/fuse/dir.c
Pull new-efi-memmap into release branch
[linux-2.6-omap-h63xx.git] / fs / fuse / dir.c
index cf5d1faed7af44b64993cfd085c5e668836a9dc8..29f1e9f6e85c3648c8a3deeb7847d078625e9844 100644 (file)
@@ -46,12 +46,12 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
                struct inode *inode = entry->d_inode;
                struct fuse_inode *fi = get_fuse_inode(inode);
                struct fuse_conn *fc = get_fuse_conn(inode);
-               struct fuse_req *req = fuse_get_request_nonint(fc);
+               struct fuse_req *req = fuse_get_request(fc);
                if (!req)
                        return 0;
 
                fuse_lookup_init(req, entry->d_parent->d_inode, entry, &outarg);
-               request_send_nonint(fc, req);
+               request_send(fc, req);
                err = req->out.h.error;
                if (!err) {
                        if (outarg.nodeid != get_node_id(inode)) {
@@ -91,11 +91,13 @@ static int fuse_lookup_iget(struct inode *dir, struct dentry *entry,
 
        req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        fuse_lookup_init(req, dir, entry, &outarg);
        request_send(fc, req);
        err = req->out.h.error;
+       if (!err && (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID))
+               err = -EIO;
        if (!err) {
                inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
                                  &outarg.attr);
@@ -152,6 +154,10 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
                fuse_put_request(fc, req);
                return err;
        }
+       if (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID) {
+               fuse_put_request(fc, req);
+               return -EIO;
+       }
        inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
                          &outarg.attr);
        if (!inode) {
@@ -185,7 +191,7 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode,
        struct fuse_conn *fc = get_fuse_conn(dir);
        struct fuse_req *req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        memset(&inarg, 0, sizeof(inarg));
        inarg.mode = mode;
@@ -211,7 +217,7 @@ static int fuse_mkdir(struct inode *dir, struct dentry *entry, int mode)
        struct fuse_conn *fc = get_fuse_conn(dir);
        struct fuse_req *req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        memset(&inarg, 0, sizeof(inarg));
        inarg.mode = mode;
@@ -236,7 +242,7 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry,
 
        req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        req->in.h.opcode = FUSE_SYMLINK;
        req->in.numargs = 2;
@@ -253,7 +259,7 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
        struct fuse_conn *fc = get_fuse_conn(dir);
        struct fuse_req *req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        req->in.h.opcode = FUSE_UNLINK;
        req->in.h.nodeid = get_node_id(dir);
@@ -284,7 +290,7 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
        struct fuse_conn *fc = get_fuse_conn(dir);
        struct fuse_req *req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        req->in.h.opcode = FUSE_RMDIR;
        req->in.h.nodeid = get_node_id(dir);
@@ -311,7 +317,7 @@ static int fuse_rename(struct inode *olddir, struct dentry *oldent,
        struct fuse_conn *fc = get_fuse_conn(olddir);
        struct fuse_req *req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        memset(&inarg, 0, sizeof(inarg));
        inarg.newdir = get_node_id(newdir);
@@ -356,7 +362,7 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
        struct fuse_conn *fc = get_fuse_conn(inode);
        struct fuse_req *req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        memset(&inarg, 0, sizeof(inarg));
        inarg.oldnodeid = get_node_id(inode);
@@ -386,7 +392,7 @@ int fuse_do_getattr(struct inode *inode)
        struct fuse_conn *fc = get_fuse_conn(inode);
        struct fuse_req *req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        req->in.h.opcode = FUSE_GETATTR;
        req->in.h.nodeid = get_node_id(inode);
@@ -533,7 +539,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
        struct page *page;
        struct inode *inode = file->f_dentry->d_inode;
        struct fuse_conn *fc = get_fuse_conn(inode);
-       struct fuse_req *req = fuse_get_request_nonint(fc);
+       struct fuse_req *req = fuse_get_request(fc);
        if (!req)
                return -EINTR;
 
@@ -552,6 +558,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
                                    filldir);
 
        __free_page(page);
+       fuse_invalidate_attr(inode); /* atime changed */
        return err;
 }
 
@@ -563,7 +570,7 @@ static char *read_link(struct dentry *dentry)
        char *link;
 
        if (!req)
-               return ERR_PTR(-ERESTARTNOINTR);
+               return ERR_PTR(-EINTR);
 
        link = (char *) __get_free_page(GFP_KERNEL);
        if (!link) {
@@ -585,6 +592,7 @@ static char *read_link(struct dentry *dentry)
                link[req->out.args[0].size] = '\0';
  out:
        fuse_put_request(fc, req);
+       fuse_invalidate_attr(inode); /* atime changed */
        return link;
 }
 
@@ -615,6 +623,12 @@ static int fuse_dir_release(struct inode *inode, struct file *file)
        return fuse_release_common(inode, file, 1);
 }
 
+static int fuse_dir_fsync(struct file *file, struct dentry *de, int datasync)
+{
+       /* nfsd can call this with no file */
+       return file ? fuse_fsync_common(file, de, datasync, 1) : 0;
+}
+
 static unsigned iattr_to_fattr(struct iattr *iattr, struct fuse_attr *fattr)
 {
        unsigned ivalid = iattr->ia_valid;
@@ -669,7 +683,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
 
        req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        memset(&inarg, 0, sizeof(inarg));
        inarg.valid = iattr_to_fattr(attr, &inarg.attr);
@@ -753,7 +767,7 @@ static int fuse_setxattr(struct dentry *entry, const char *name,
 
        req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        memset(&inarg, 0, sizeof(inarg));
        inarg.size = size;
@@ -793,7 +807,7 @@ static ssize_t fuse_getxattr(struct dentry *entry, const char *name,
 
        req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        memset(&inarg, 0, sizeof(inarg));
        inarg.size = size;
@@ -843,7 +857,7 @@ static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
 
        req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        memset(&inarg, 0, sizeof(inarg));
        inarg.size = size;
@@ -889,7 +903,7 @@ static int fuse_removexattr(struct dentry *entry, const char *name)
 
        req = fuse_get_request(fc);
        if (!req)
-               return -ERESTARTNOINTR;
+               return -EINTR;
 
        req->in.h.opcode = FUSE_REMOVEXATTR;
        req->in.h.nodeid = get_node_id(inode);
@@ -932,6 +946,7 @@ static struct file_operations fuse_dir_operations = {
        .readdir        = fuse_readdir,
        .open           = fuse_dir_open,
        .release        = fuse_dir_release,
+       .fsync          = fuse_dir_fsync,
 };
 
 static struct inode_operations fuse_common_inode_operations = {