aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/control.c2
-rw-r--r--fs/fuse/dev.c39
-rw-r--r--fs/fuse/dir.c6
-rw-r--r--fs/fuse/file.c6
-rw-r--r--fs/fuse/inode.c1
5 files changed, 21 insertions, 33 deletions
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 79ec1f23d4d2..16b39c053d47 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -116,7 +116,7 @@ int fuse_ctl_add_conn(struct fuse_conn *fc)
116 return 0; 116 return 0;
117 117
118 parent = fuse_control_sb->s_root; 118 parent = fuse_control_sb->s_root;
119 parent->d_inode->i_nlink++; 119 inc_nlink(parent->d_inode);
120 sprintf(name, "%llu", (unsigned long long) fc->id); 120 sprintf(name, "%llu", (unsigned long long) fc->id);
121 parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500, 2, 121 parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500, 2,
122 &simple_dir_inode_operations, 122 &simple_dir_inode_operations,
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 1e2006caf158..66571eafbb1e 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -212,6 +212,7 @@ void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)
212 * Called with fc->lock, unlocks it 212 * Called with fc->lock, unlocks it
213 */ 213 */
214static void request_end(struct fuse_conn *fc, struct fuse_req *req) 214static void request_end(struct fuse_conn *fc, struct fuse_req *req)
215 __releases(fc->lock)
215{ 216{
216 void (*end) (struct fuse_conn *, struct fuse_req *) = req->end; 217 void (*end) (struct fuse_conn *, struct fuse_req *) = req->end;
217 req->end = NULL; 218 req->end = NULL;
@@ -640,6 +641,7 @@ static void request_wait(struct fuse_conn *fc)
640 */ 641 */
641static int fuse_read_interrupt(struct fuse_conn *fc, struct fuse_req *req, 642static int fuse_read_interrupt(struct fuse_conn *fc, struct fuse_req *req,
642 const struct iovec *iov, unsigned long nr_segs) 643 const struct iovec *iov, unsigned long nr_segs)
644 __releases(fc->lock)
643{ 645{
644 struct fuse_copy_state cs; 646 struct fuse_copy_state cs;
645 struct fuse_in_header ih; 647 struct fuse_in_header ih;
@@ -678,14 +680,15 @@ static int fuse_read_interrupt(struct fuse_conn *fc, struct fuse_req *req,
678 * request_end(). Otherwise add it to the processing list, and set 680 * request_end(). Otherwise add it to the processing list, and set
679 * the 'sent' flag. 681 * the 'sent' flag.
680 */ 682 */
681static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov, 683static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov,
682 unsigned long nr_segs, loff_t *off) 684 unsigned long nr_segs, loff_t pos)
683{ 685{
684 int err; 686 int err;
685 struct fuse_req *req; 687 struct fuse_req *req;
686 struct fuse_in *in; 688 struct fuse_in *in;
687 struct fuse_copy_state cs; 689 struct fuse_copy_state cs;
688 unsigned reqsize; 690 unsigned reqsize;
691 struct file *file = iocb->ki_filp;
689 struct fuse_conn *fc = fuse_get_conn(file); 692 struct fuse_conn *fc = fuse_get_conn(file);
690 if (!fc) 693 if (!fc)
691 return -EPERM; 694 return -EPERM;
@@ -759,15 +762,6 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
759 return err; 762 return err;
760} 763}
761 764
762static ssize_t fuse_dev_read(struct file *file, char __user *buf,
763 size_t nbytes, loff_t *off)
764{
765 struct iovec iov;
766 iov.iov_len = nbytes;
767 iov.iov_base = buf;
768 return fuse_dev_readv(file, &iov, 1, off);
769}
770
771/* Look up request on processing list by unique ID */ 765/* Look up request on processing list by unique ID */
772static struct fuse_req *request_find(struct fuse_conn *fc, u64 unique) 766static struct fuse_req *request_find(struct fuse_conn *fc, u64 unique)
773{ 767{
@@ -812,15 +806,15 @@ static int copy_out_args(struct fuse_copy_state *cs, struct fuse_out *out,
812 * it from the list and copy the rest of the buffer to the request. 806 * it from the list and copy the rest of the buffer to the request.
813 * The request is finished by calling request_end() 807 * The request is finished by calling request_end()
814 */ 808 */
815static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov, 809static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,
816 unsigned long nr_segs, loff_t *off) 810 unsigned long nr_segs, loff_t pos)
817{ 811{
818 int err; 812 int err;
819 unsigned nbytes = iov_length(iov, nr_segs); 813 unsigned nbytes = iov_length(iov, nr_segs);
820 struct fuse_req *req; 814 struct fuse_req *req;
821 struct fuse_out_header oh; 815 struct fuse_out_header oh;
822 struct fuse_copy_state cs; 816 struct fuse_copy_state cs;
823 struct fuse_conn *fc = fuse_get_conn(file); 817 struct fuse_conn *fc = fuse_get_conn(iocb->ki_filp);
824 if (!fc) 818 if (!fc)
825 return -EPERM; 819 return -EPERM;
826 820
@@ -896,15 +890,6 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
896 return err; 890 return err;
897} 891}
898 892
899static ssize_t fuse_dev_write(struct file *file, const char __user *buf,
900 size_t nbytes, loff_t *off)
901{
902 struct iovec iov;
903 iov.iov_len = nbytes;
904 iov.iov_base = (char __user *) buf;
905 return fuse_dev_writev(file, &iov, 1, off);
906}
907
908static unsigned fuse_dev_poll(struct file *file, poll_table *wait) 893static unsigned fuse_dev_poll(struct file *file, poll_table *wait)
909{ 894{
910 unsigned mask = POLLOUT | POLLWRNORM; 895 unsigned mask = POLLOUT | POLLWRNORM;
@@ -1039,10 +1024,10 @@ static int fuse_dev_fasync(int fd, struct file *file, int on)
1039const struct file_operations fuse_dev_operations = { 1024const struct file_operations fuse_dev_operations = {
1040 .owner = THIS_MODULE, 1025 .owner = THIS_MODULE,
1041 .llseek = no_llseek, 1026 .llseek = no_llseek,
1042 .read = fuse_dev_read, 1027 .read = do_sync_read,
1043 .readv = fuse_dev_readv, 1028 .aio_read = fuse_dev_read,
1044 .write = fuse_dev_write, 1029 .write = do_sync_write,
1045 .writev = fuse_dev_writev, 1030 .aio_write = fuse_dev_write,
1046 .poll = fuse_dev_poll, 1031 .poll = fuse_dev_poll,
1047 .release = fuse_dev_release, 1032 .release = fuse_dev_release,
1048 .fasync = fuse_dev_fasync, 1033 .fasync = fuse_dev_fasync,
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 409ce6a7cca4..8605155db171 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -508,7 +508,7 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
508 /* Set nlink to zero so the inode can be cleared, if 508 /* Set nlink to zero so the inode can be cleared, if
509 the inode does have more links this will be 509 the inode does have more links this will be
510 discovered at the next lookup/getattr */ 510 discovered at the next lookup/getattr */
511 inode->i_nlink = 0; 511 clear_nlink(inode);
512 fuse_invalidate_attr(inode); 512 fuse_invalidate_attr(inode);
513 fuse_invalidate_attr(dir); 513 fuse_invalidate_attr(dir);
514 fuse_invalidate_entry_cache(entry); 514 fuse_invalidate_entry_cache(entry);
@@ -534,7 +534,7 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
534 err = req->out.h.error; 534 err = req->out.h.error;
535 fuse_put_request(fc, req); 535 fuse_put_request(fc, req);
536 if (!err) { 536 if (!err) {
537 entry->d_inode->i_nlink = 0; 537 clear_nlink(entry->d_inode);
538 fuse_invalidate_attr(dir); 538 fuse_invalidate_attr(dir);
539 fuse_invalidate_entry_cache(entry); 539 fuse_invalidate_entry_cache(entry);
540 } else if (err == -EINTR) 540 } else if (err == -EINTR)
@@ -776,7 +776,7 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
776 if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO)) 776 if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO))
777 return -EACCES; 777 return -EACCES;
778 778
779 if (nd && (nd->flags & LOOKUP_ACCESS)) 779 if (nd && (nd->flags & (LOOKUP_ACCESS | LOOKUP_CHDIR)))
780 return fuse_access(inode, mask); 780 return fuse_access(inode, mask);
781 return 0; 781 return 0;
782 } 782 }
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 5c4fcd1dbf59..183626868eea 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -753,8 +753,10 @@ static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl)
753 753
754static const struct file_operations fuse_file_operations = { 754static const struct file_operations fuse_file_operations = {
755 .llseek = generic_file_llseek, 755 .llseek = generic_file_llseek,
756 .read = generic_file_read, 756 .read = do_sync_read,
757 .write = generic_file_write, 757 .aio_read = generic_file_aio_read,
758 .write = do_sync_write,
759 .aio_write = generic_file_aio_write,
758 .mmap = fuse_file_mmap, 760 .mmap = fuse_file_mmap,
759 .open = fuse_open, 761 .open = fuse_open,
760 .flush = fuse_flush, 762 .flush = fuse_flush,
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index cb7cadb0b790..7d0a9aee01f2 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -251,6 +251,7 @@ static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf)
251 memset(&outarg, 0, sizeof(outarg)); 251 memset(&outarg, 0, sizeof(outarg));
252 req->in.numargs = 0; 252 req->in.numargs = 0;
253 req->in.h.opcode = FUSE_STATFS; 253 req->in.h.opcode = FUSE_STATFS;
254 req->in.h.nodeid = get_node_id(dentry->d_inode);
254 req->out.numargs = 1; 255 req->out.numargs = 1;
255 req->out.args[0].size = 256 req->out.args[0].size =
256 fc->minor < 4 ? FUSE_COMPAT_STATFS_SIZE : sizeof(outarg); 257 fc->minor < 4 ? FUSE_COMPAT_STATFS_SIZE : sizeof(outarg);