summaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
Commit message (Collapse)AuthorAgeFilesLines
* NFS: Avoid a deadlock situation on writeTrond Myklebust2007-05-241-2/+4
| | | | | | | | | | | | | When processes are allowed to attempt to lock a non-contiguous range of nfs write requests, it is possible for generic_writepages to 'wrap round' the address space, and call writepage() on a request that is already locked by the same process. We avoid the deadlock by checking if the page index is contiguous with the list of nfs write requests that is already held in our nfs_pageio_descriptor prior to attempting to lock a new request. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Fix some 'sparse' warnings...Trond Myklebust2007-05-141-2/+2
| | | | | | | | | | | | | | - fs/nfs/dir.c:610:8: warning: symbol 'nfs_llseek_dir' was not declared. Should it be static? - fs/nfs/dir.c:636:5: warning: symbol 'nfs_fsync_dir' was not declared. Should it be static? - fs/nfs/write.c:925:19: warning: symbol 'req' shadows an earlier one - fs/nfs/write.c:61:6: warning: symbol 'nfs_commit_rcu_free' was not declared. Should it be static? - fs/nfs/nfs4proc.c:793:5: warning: symbol 'nfs4_recover_expired_lease' was not declared. Should it be static? Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: use zero_user_pageNate Diller2007-05-141-1/+1
| | | | | | | | | | Use zero_user_page() instead of the newly deprecated memclear_highpage_flush(). Signed-off-by: Nate Diller <nate.diller@gmail.com> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: "J. Bruce Fields" <bfields@fieldses.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* nfs: fix congestion control: use atomic_longsPeter Zijlstra2007-05-081-2/+2
| | | | | | | | | | | | Change the atomic_t in struct nfs_server to atomic_long_t in anticipation of machines that can handle 8+TB of (4K) pages under writeback. However I suspect other things in NFS will start going *bang* by then. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* header cleaning: don't include smp_lock.h when not usedRandy Dunlap2007-05-081-1/+0
| | | | | | | | | | | | Remove includes of <linux/smp_lock.h> where it is not used/needed. Suggested by Al Viro. Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc, sparc64, and arm (all 59 defconfigs). Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* NFS: Use pgoff_t in structures and functions that pass page cache offsetsTrond Myklebust2007-04-301-9/+9
| | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Clean up nfs_sync_mapping_wait()Trond Myklebust2007-04-301-5/+1
| | | | | | It has no business touching wbc->pages_skipped. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Fix a buffer overflow in the allocation of struct nfs_read/writedataTrond Myklebust2007-04-301-6/+5
| | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Fix a race when doing NFS write coalescingTrond Myklebust2007-04-301-102/+47
| | | | | | | | | | | | | | Currently we do write coalescing in a very inefficient manner: one pass in generic_writepages() in order to lock the pages for writing, then one pass in nfs_flush_mapping() and/or nfs_sync_mapping_wait() in order to gather the locked pages for coalescing into RPC requests of size "wsize". In fact, it turns out there is actually a deadlock possible here since we only start I/O on the second pass. If the user signals the process while we're in nfs_sync_mapping_wait(), for instance, then we may exit before starting I/O on all the requests that have been queued up. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Another cleanup of the read/write request coalescing codeTrond Myklebust2007-04-301-33/+20
| | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Cleanup the coalescing codeTrond Myklebust2007-04-301-6/+5
| | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Don't wait for congestion in nfs_update_request()Trond Myklebust2007-04-301-30/+0
| | | | | | | It is redundant, and will interfere with the call to balance_dirty_pages_ratelimited_nr in generic_file_write(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Fix nfs_set_page_dirty()Trond Myklebust2007-04-301-1/+11
| | | | | | Be more careful about testing page->mapping. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Fix race in nfs_set_page_dirtyTrond Myklebust2007-04-201-3/+14
| | | | | | | Protect nfs_set_page_dirty() against races with nfs_inode_add_request. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* NFS: Fix the 'desynchronized value of nfs_i.ncommit' errorTrond Myklebust2007-04-201-25/+22
| | | | | | | | | | | | | | | Redirtying a request that is already marked for commit will screw up the accounting for NR_UNSTABLE_NFS as well as nfs_i.ncommit. Ensure that all requests on the commit queue are labelled with the PG_NEED_COMMIT flag, and avoid moving them onto the dirty list inside nfs_page_mark_flush(). Also inline nfs_mark_request_dirty() into nfs_page_mark_flush() for atomicity reasons. Avoid dropping the spinlock until we're done marking the request in the radix tree and have added it to the ->dirty list. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* NFS: Don't clear PG_writeback until after we've processed unstable writesTrond Myklebust2007-04-201-3/+3
| | | | | | | | Ensure that we don't release the PG_writeback lock until after the page has either been redirtied, or queued on the nfs_inode 'commit' list. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* NFS: clean up the unstable write codeTrond Myklebust2007-04-201-46/+71
| | | | | | | Get rid of the inlined #ifdefs. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* NFS: Fix a list corruption problemTrond Myklebust2007-04-151-1/+3
| | | | | | | | We must remove the request from whatever list it is currently on before we can add it to the dirty list. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* NFS: Ensure PG_writeback is cleared when writeback failsTrond Myklebust2007-04-141-7/+15
| | | | | | | | | | | | | | | | If the writebacks are cancelled via nfs_cancel_dirty_list, or due to the memory allocation failing in nfs_flush_one/nfs_flush_multi, then we must ensure that the PG_writeback flag is cleared. Also ensure that we actually own the PG_writeback flag whenever we schedule a new writeback by making nfs_set_page_writeback() return the value of test_set_page_writeback(). The PG_writeback page flag ends up replacing the functionality of the PG_FLUSHING nfs_page flag, so we rip that out too. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* [PATCH] nfs: fix congestion controlPeter Zijlstra2007-03-161-42/+74
| | | | | | | | | | | | | | | | | | | The current NFS client congestion logic is severly broken, it marks the backing device congested during each nfs_writepages() call but doesn't mirror this in nfs_writepage() which makes for deadlocks. Also it implements its own waitqueue. Replace this by a more regular congestion implementation that puts a cap on the number of active writeback pages and uses the bdi congestion waitqueue. Also always use an interruptible wait since it makes sense to be able to SIGKILL the process even for mounts without 'intr'. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: Christoph Lameter <clameter@engr.sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* NFS: Don't use ClearPageUptodate() when writeback failsTrond Myklebust2007-02-121-5/+10
| | | | | | | ClearPageUptodate() will just cause races here. What we really want to do is to invalidate the page cache. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: fix print format for tk_pidChuck Lever2007-02-031-4/+5
| | | | | | | | | | The tk_pid field is an unsigned short. The proper print format specifier for that type is %5u, not %4d. Also clean up some miscellaneous print formatting nits. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Fixup some outdated comments...Trond Myklebust2007-02-031-41/+1
| | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: nfs_writepages() cleanupTrond Myklebust2007-02-031-20/+1
| | | | | | | Strip out the call to nfs_commit_inode(), and allow that to be done by nfs_write_inode(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Micro-optimisation for nfs_wb_page()Trond Myklebust2007-02-031-0/+2
| | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Ensure that ->writepage() uses flush_stable() when reclaiming pagesTrond Myklebust2007-02-031-1/+1
| | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* [PATCH] nfs: change uses of f_{dentry,vfsmnt} to use f_pathJosef "Jeff" Sipek2006-12-081-2/+2
| | | | | | | | | Change all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt} in the nfs client code. Signed-off-by: Josef "Jeff" Sipek <jsipek@cs.sunysb.edu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Merge branch 'master' of /home/trondmy/kernel/linux-2.6/ into merge_linusTrond Myklebust2006-12-071-3/+3
|\
| * [PATCH] slab: remove kmem_cache_tChristoph Lameter2006-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace all uses of kmem_cache_t with struct kmem_cache. The patch was generated using the following script: #!/bin/sh # # Replace one string by another in all the kernel sources. # set -e for file in `find * -name "*.c" -o -name "*.h"|xargs grep -l $1`; do quilt add $file sed -e "1,\$s/$1/$2/g" $file >/tmp/$$ mv /tmp/$$ $file quilt refresh done The script was run like this sh replace kmem_cache_t "struct kmem_cache" Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| * [PATCH] slab: remove SLAB_NOFSChristoph Lameter2006-12-071-2/+2
| | | | | | | | | | | | | | | | SLAB_NOFS is an alias of GFP_NOFS. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* | NFS: Clean up calls to mark_inode_dirty() part 2Trond Myklebust2006-12-061-2/+2
| | | | | | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Fix up the dirty page accountingTrond Myklebust2006-12-061-1/+0
| | | | | | | | | | | | | | | | | | | | There is now no reason to account for the dirty pages in the NFS code, since the VM code will now do it for us via __set_page_dirty_nobuffers(), and set_page_writeback(). We still need to keep the accounting of stable writes, though. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Ensure the inode is marked as dirty if we break out of nfs_wb_all()Trond Myklebust2006-12-061-0/+3
| | | | | | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Ensure we only call set_page_writeback() under the page lockTrond Myklebust2006-12-061-10/+28
| | | | | | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Make nfs_updatepage() mark the page as dirty.Trond Myklebust2006-12-061-17/+56
| | | | | | | | | | | | | | This will ensure that we can call set_page_writeback() from within nfs_writepage(), which is always called with the page lock set. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Ensure that nfs_wb_page() calls writepage when necessary.Trond Myklebust2006-12-061-4/+30
| | | | | | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Add nfs_set_page_dirty()Trond Myklebust2006-12-061-13/+36
| | | | | | | | | | | | | | | | | | | | We will want to allow nfs_writepage() to distinguish between pages that have been marked as dirty by the VM, and those that have been marked as dirty by nfs_updatepage(). In the former case, the entire page will want to be written out, and so any requests that were pending need to be flushed out first. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Remove nfs_writepage_sync()Trond Myklebust2006-12-061-96/+4
| | | | | | | | | | | | | | | | Maintaining two parallel ways of doing synchronous writes is rather pointless. This patch gets rid of the legacy nfs_writepage_sync(), and replaces it with the faster asynchronous writes. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: More cleanups of fs/nfs/write.cTrond Myklebust2006-12-061-44/+24
| | | | | | | | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Remove call to igrab() from nfs_writepage()Trond Myklebust2006-12-061-15/+1
| | | | | | | | | | | | | | | | We always ensure that the nfs_open_context holds a reference to the dentry, so the test in nfs_writepage() for whether or not the inode is referenced is redundant. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Cleanup: add common helper nfs_page_length()Trond Myklebust2006-12-061-45/+10
| | | | | | | | | | | | Clean up a lot of ad-hoc page length calculations in fs/nfs/write.c Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Store pointer to the nfs_page in page->privateTrond Myklebust2006-12-061-33/+33
| | | | | | | | | | | | | | This will allow fast lookup of the nfs_page from the struct page instead of having to search the radix tree. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: cleanup of nfs_sync_inode_wait()Trond Myklebust2006-12-061-12/+81
| | | | | | | | | | | | Allow callers to directly pass it a struct writeback_control. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Clean up nfs_scan_dirty()Trond Myklebust2006-12-061-38/+16
| | | | | | | | | | | | Pass down struct writeback control. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Clean up nfs_flush_inode()Trond Myklebust2006-12-061-10/+10
| | | | | | | | | | | | | | Make it take a struct writepages argument, and rename to nfs_flush_mapping(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Remove use of the Big Kernel Lock around calls to rpc_execute.Frank Filz2006-12-061-2/+0
| | | | | | | | | | | | | | Remove use of the Big Kernel Lock around calls to rpc_execute. Signed-off-by: Frank Filz <ffilz@us.ibm.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | NFS: Fix nfs_sync_inode_wait(FLUSH_INVALIDATE)Trond Myklebust2006-12-061-2/+4
| | | | | | | | | | | | | | Currently nfs_sync_inode_wait() will fail to loop correctly when we call nfs_sync_inode_wait with the FLUSH_INVALIDATE argument. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* | SUNRPC: Fix a potential race in rpc_wake_up_task()Trond Myklebust2006-12-061-4/+16
|/ | | | | | | | Use RCU to ensure that we can safely call rpc_finish_wakeup after we've called __rpc_do_wake_up_task. If not, there is a theoretical race, in which the rpc_task finishes executing, and gets freed first. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* [PATCH] NFS: Fix oops in nfs_cancel_commit_listTrond Myklebust2006-10-201-2/+2
| | | | | | | | | | | | | | Fix two bugs: - nfs_inode_remove_request will call nfs_clear_request, so we cannot reference req->wb_page after it. Move the call to dec_zone_page_state so that it occurs while req->wb_page is still valid. - Calling nfs_clear_page_writeback is unnecessary since the radix tree tags will have been cleared by the call to nfs_inode_remove_request. Replace with a simple call to nfs_unlock_request. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] separate bdi congestion functions from queue congestion functionsAndrew Morton2006-10-201-1/+3
| | | | | | | | | | | | | | | | | | | Separate out the concept of "queue congestion" from "backing-dev congestion". Congestion is a backing-dev concept, not a queue concept. The blk_* congestion functions are retained, as wrappers around the core backing-dev congestion functions. This proper layering is needed so that NFS can cleanly use the congestion functions, and so that CONFIG_BLOCK=n actually links. Cc: "Thomas Maier" <balagi@justmail.de> Cc: "Jens Axboe" <jens.axboe@oracle.com> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: David Howells <dhowells@redhat.com> Cc: Peter Osterlund <petero2@telia.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
OpenPOWER on IntegriCloud