aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/dir.c8
-rw-r--r--fs/nfs/direct.c26
-rw-r--r--fs/nfs/file.c34
-rw-r--r--fs/nfs/write.c1
4 files changed, 42 insertions, 27 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 7432f1a43f3d..481f8892a919 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -843,7 +843,7 @@ static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
843 nfs_inode_return_delegation(inode); 843 nfs_inode_return_delegation(inode);
844 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { 844 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
845 lock_kernel(); 845 lock_kernel();
846 inode->i_nlink--; 846 drop_nlink(inode);
847 nfs_complete_unlink(dentry); 847 nfs_complete_unlink(dentry);
848 unlock_kernel(); 848 unlock_kernel();
849 } 849 }
@@ -1286,7 +1286,7 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry)
1286 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); 1286 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
1287 /* Ensure the VFS deletes this inode */ 1287 /* Ensure the VFS deletes this inode */
1288 if (error == 0 && dentry->d_inode != NULL) 1288 if (error == 0 && dentry->d_inode != NULL)
1289 dentry->d_inode->i_nlink = 0; 1289 clear_nlink(dentry->d_inode);
1290 nfs_end_data_update(dir); 1290 nfs_end_data_update(dir);
1291 unlock_kernel(); 1291 unlock_kernel();
1292 1292
@@ -1401,7 +1401,7 @@ static int nfs_safe_remove(struct dentry *dentry)
1401 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); 1401 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
1402 /* The VFS may want to delete this inode */ 1402 /* The VFS may want to delete this inode */
1403 if (error == 0) 1403 if (error == 0)
1404 inode->i_nlink--; 1404 drop_nlink(inode);
1405 nfs_mark_for_revalidate(inode); 1405 nfs_mark_for_revalidate(inode);
1406 nfs_end_data_update(inode); 1406 nfs_end_data_update(inode);
1407 } else 1407 } else
@@ -1639,7 +1639,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1639 goto out; 1639 goto out;
1640 } 1640 }
1641 } else 1641 } else
1642 new_inode->i_nlink--; 1642 drop_nlink(new_inode);
1643 1643
1644go_ahead: 1644go_ahead:
1645 /* 1645 /*
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 377839bed172..9f7f8b9ea1e2 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -707,8 +707,8 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
707/** 707/**
708 * nfs_file_direct_read - file direct read operation for NFS files 708 * nfs_file_direct_read - file direct read operation for NFS files
709 * @iocb: target I/O control block 709 * @iocb: target I/O control block
710 * @buf: user's buffer into which to read data 710 * @iov: vector of user buffers into which to read data
711 * @count: number of bytes to read 711 * @nr_segs: size of iov vector
712 * @pos: byte offset in file where reading starts 712 * @pos: byte offset in file where reading starts
713 * 713 *
714 * We use this function for direct reads instead of calling 714 * We use this function for direct reads instead of calling
@@ -725,17 +725,24 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
725 * client must read the updated atime from the server back into its 725 * client must read the updated atime from the server back into its
726 * cache. 726 * cache.
727 */ 727 */
728ssize_t nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t pos) 728ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
729 unsigned long nr_segs, loff_t pos)
729{ 730{
730 ssize_t retval = -EINVAL; 731 ssize_t retval = -EINVAL;
731 struct file *file = iocb->ki_filp; 732 struct file *file = iocb->ki_filp;
732 struct address_space *mapping = file->f_mapping; 733 struct address_space *mapping = file->f_mapping;
734 /* XXX: temporary */
735 const char __user *buf = iov[0].iov_base;
736 size_t count = iov[0].iov_len;
733 737
734 dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n", 738 dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n",
735 file->f_dentry->d_parent->d_name.name, 739 file->f_dentry->d_parent->d_name.name,
736 file->f_dentry->d_name.name, 740 file->f_dentry->d_name.name,
737 (unsigned long) count, (long long) pos); 741 (unsigned long) count, (long long) pos);
738 742
743 if (nr_segs != 1)
744 return -EINVAL;
745
739 if (count < 0) 746 if (count < 0)
740 goto out; 747 goto out;
741 retval = -EFAULT; 748 retval = -EFAULT;
@@ -760,8 +767,8 @@ out:
760/** 767/**
761 * nfs_file_direct_write - file direct write operation for NFS files 768 * nfs_file_direct_write - file direct write operation for NFS files
762 * @iocb: target I/O control block 769 * @iocb: target I/O control block
763 * @buf: user's buffer from which to write data 770 * @iov: vector of user buffers from which to write data
764 * @count: number of bytes to write 771 * @nr_segs: size of iov vector
765 * @pos: byte offset in file where writing starts 772 * @pos: byte offset in file where writing starts
766 * 773 *
767 * We use this function for direct writes instead of calling 774 * We use this function for direct writes instead of calling
@@ -782,17 +789,24 @@ out:
782 * Note that O_APPEND is not supported for NFS direct writes, as there 789 * Note that O_APPEND is not supported for NFS direct writes, as there
783 * is no atomic O_APPEND write facility in the NFS protocol. 790 * is no atomic O_APPEND write facility in the NFS protocol.
784 */ 791 */
785ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos) 792ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
793 unsigned long nr_segs, loff_t pos)
786{ 794{
787 ssize_t retval; 795 ssize_t retval;
788 struct file *file = iocb->ki_filp; 796 struct file *file = iocb->ki_filp;
789 struct address_space *mapping = file->f_mapping; 797 struct address_space *mapping = file->f_mapping;
798 /* XXX: temporary */
799 const char __user *buf = iov[0].iov_base;
800 size_t count = iov[0].iov_len;
790 801
791 dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n", 802 dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n",
792 file->f_dentry->d_parent->d_name.name, 803 file->f_dentry->d_parent->d_name.name,
793 file->f_dentry->d_name.name, 804 file->f_dentry->d_name.name,
794 (unsigned long) count, (long long) pos); 805 (unsigned long) count, (long long) pos);
795 806
807 if (nr_segs != 1)
808 return -EINVAL;
809
796 retval = generic_write_checks(file, &pos, &count, 0); 810 retval = generic_write_checks(file, &pos, &count, 0);
797 if (retval) 811 if (retval)
798 goto out; 812 goto out;
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index be997d649127..cc93865cea93 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -41,8 +41,10 @@ static int nfs_file_release(struct inode *, struct file *);
41static loff_t nfs_file_llseek(struct file *file, loff_t offset, int origin); 41static loff_t nfs_file_llseek(struct file *file, loff_t offset, int origin);
42static int nfs_file_mmap(struct file *, struct vm_area_struct *); 42static int nfs_file_mmap(struct file *, struct vm_area_struct *);
43static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); 43static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *);
44static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t); 44static ssize_t nfs_file_read(struct kiocb *, const struct iovec *iov,
45static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t); 45 unsigned long nr_segs, loff_t pos);
46static ssize_t nfs_file_write(struct kiocb *, const struct iovec *iov,
47 unsigned long nr_segs, loff_t pos);
46static int nfs_file_flush(struct file *, fl_owner_t id); 48static int nfs_file_flush(struct file *, fl_owner_t id);
47static int nfs_fsync(struct file *, struct dentry *dentry, int datasync); 49static int nfs_fsync(struct file *, struct dentry *dentry, int datasync);
48static int nfs_check_flags(int flags); 50static int nfs_check_flags(int flags);
@@ -53,8 +55,8 @@ const struct file_operations nfs_file_operations = {
53 .llseek = nfs_file_llseek, 55 .llseek = nfs_file_llseek,
54 .read = do_sync_read, 56 .read = do_sync_read,
55 .write = do_sync_write, 57 .write = do_sync_write,
56 .aio_read = nfs_file_read, 58 .aio_read = nfs_file_read,
57 .aio_write = nfs_file_write, 59 .aio_write = nfs_file_write,
58 .mmap = nfs_file_mmap, 60 .mmap = nfs_file_mmap,
59 .open = nfs_file_open, 61 .open = nfs_file_open,
60 .flush = nfs_file_flush, 62 .flush = nfs_file_flush,
@@ -196,15 +198,17 @@ nfs_file_flush(struct file *file, fl_owner_t id)
196} 198}
197 199
198static ssize_t 200static ssize_t
199nfs_file_read(struct kiocb *iocb, char __user * buf, size_t count, loff_t pos) 201nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
202 unsigned long nr_segs, loff_t pos)
200{ 203{
201 struct dentry * dentry = iocb->ki_filp->f_dentry; 204 struct dentry * dentry = iocb->ki_filp->f_dentry;
202 struct inode * inode = dentry->d_inode; 205 struct inode * inode = dentry->d_inode;
203 ssize_t result; 206 ssize_t result;
207 size_t count = iov_length(iov, nr_segs);
204 208
205#ifdef CONFIG_NFS_DIRECTIO 209#ifdef CONFIG_NFS_DIRECTIO
206 if (iocb->ki_filp->f_flags & O_DIRECT) 210 if (iocb->ki_filp->f_flags & O_DIRECT)
207 return nfs_file_direct_read(iocb, buf, count, pos); 211 return nfs_file_direct_read(iocb, iov, nr_segs, pos);
208#endif 212#endif
209 213
210 dfprintk(VFS, "nfs: read(%s/%s, %lu@%lu)\n", 214 dfprintk(VFS, "nfs: read(%s/%s, %lu@%lu)\n",
@@ -214,7 +218,7 @@ nfs_file_read(struct kiocb *iocb, char __user * buf, size_t count, loff_t pos)
214 result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping); 218 result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
215 nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, count); 219 nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, count);
216 if (!result) 220 if (!result)
217 result = generic_file_aio_read(iocb, buf, count, pos); 221 result = generic_file_aio_read(iocb, iov, nr_segs, pos);
218 return result; 222 return result;
219} 223}
220 224
@@ -336,24 +340,22 @@ const struct address_space_operations nfs_file_aops = {
336#endif 340#endif
337}; 341};
338 342
339/* 343static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
340 * Write to a file (through the page cache). 344 unsigned long nr_segs, loff_t pos)
341 */
342static ssize_t
343nfs_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos)
344{ 345{
345 struct dentry * dentry = iocb->ki_filp->f_dentry; 346 struct dentry * dentry = iocb->ki_filp->f_dentry;
346 struct inode * inode = dentry->d_inode; 347 struct inode * inode = dentry->d_inode;
347 ssize_t result; 348 ssize_t result;
349 size_t count = iov_length(iov, nr_segs);
348 350
349#ifdef CONFIG_NFS_DIRECTIO 351#ifdef CONFIG_NFS_DIRECTIO
350 if (iocb->ki_filp->f_flags & O_DIRECT) 352 if (iocb->ki_filp->f_flags & O_DIRECT)
351 return nfs_file_direct_write(iocb, buf, count, pos); 353 return nfs_file_direct_write(iocb, iov, nr_segs, pos);
352#endif 354#endif
353 355
354 dfprintk(VFS, "nfs: write(%s/%s(%ld), %lu@%lu)\n", 356 dfprintk(VFS, "nfs: write(%s/%s(%ld), %lu@%Ld)\n",
355 dentry->d_parent->d_name.name, dentry->d_name.name, 357 dentry->d_parent->d_name.name, dentry->d_name.name,
356 inode->i_ino, (unsigned long) count, (unsigned long) pos); 358 inode->i_ino, (unsigned long) count, (long long) pos);
357 359
358 result = -EBUSY; 360 result = -EBUSY;
359 if (IS_SWAPFILE(inode)) 361 if (IS_SWAPFILE(inode))
@@ -372,7 +374,7 @@ nfs_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t
372 goto out; 374 goto out;
373 375
374 nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, count); 376 nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, count);
375 result = generic_file_aio_write(iocb, buf, count, pos); 377 result = generic_file_aio_write(iocb, iov, nr_segs, pos);
376out: 378out:
377 return result; 379 return result;
378 380
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b674462793d3..f6675d2c386c 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -51,7 +51,6 @@
51#include <linux/mm.h> 51#include <linux/mm.h>
52#include <linux/pagemap.h> 52#include <linux/pagemap.h>
53#include <linux/file.h> 53#include <linux/file.h>
54#include <linux/mpage.h>
55#include <linux/writeback.h> 54#include <linux/writeback.h>
56 55
57#include <linux/sunrpc/clnt.h> 56#include <linux/sunrpc/clnt.h>