aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs/flexfilelayout
AgeCommit message (Collapse)AuthorFilesLines
2016-01-22pNFS/flexfiles: Fix an XDR encoding bug in layoutreturnTrond Myklebust1-4/+2
We must not skip encoding the statistics, or the server will see an XDR encoding error. Signed-off-by: Trond Myklebust <[email protected]> Cc: [email protected] # 4.0+
2016-01-21pNFS/flexfiles: Improve merging of errors in LAYOUTRETURNTrond Myklebust1-59/+40
When we hit 22 errors, we start to overflow the memory buffers allocated to the LAYOUTRETURN errors. The issue is that currently, RPC call reply ordering determines how successful we are in merging errors that refer to contiguous READ or WRITE requests. Fix is to use an insertion sort to help detect contiguity. Signed-off-by: Trond Myklebust <[email protected]>
2016-01-07Merge branch 'bugfixes'Trond Myklebust1-1/+1
* bugfixes: SUNRPC: Fixup socket wait for memory SUNRPC: Fix a missing break in rpc_anyaddr() pNFS/flexfiles: Fix an Oopsable typo in ff_mirror_match_fh() NFS: Fix attribute cache revalidation NFS: Ensure we revalidate attributes before using execute_ok() NFS: Flush reclaim writes using FLUSH_COND_STABLE NFS: Background flush should not be low priority NFSv4.1/pnfs: Fixup an lo->plh_block_lgets imbalance in layoutreturn NFSv4: Don't perform cached access checks before we've OPENed the file NFS: Allow the combination pNFS and labeled NFS NFS42: handle layoutstats stateid error nfs: Fix race in __update_open_stateid() nfs: fix missing assignment in nfs4_sequence_done tracepoint
2016-01-04Merge branch 'pnfs_generic'Trond Myklebust1-12/+1
* pnfs_generic: NFSv4.1/pNFS: Cleanup constify struct pnfs_layout_range arguments NFSv4.1/pnfs: Cleanup copying of pnfs_layout_range structures NFSv4.1/pNFS: Cleanup pnfs_mark_matching_lsegs_invalid() NFSv4.1/pNFS: Fix a race in initiate_file_draining() NFSv4.1/pNFS: pnfs_error_mark_layout_for_return() must always return layout NFSv4.1/pNFS: pnfs_mark_matching_lsegs_return() should set the iomode NFSv4.1/pNFS: Use nfs4_stateid_copy for copying stateids NFSv4.1/pNFS: Don't pass stateids by value to pnfs_send_layoutreturn() NFS: Relax requirements in nfs_flush_incompatible NFSv4.1/pNFS: Don't queue up a new commit if the layout segment is invalid NFS: Allow multiple commit requests in flight per file NFS/pNFS: Fix up pNFS write reschedule layering violations and bugs NFSv4: List stateid information in the callback tracepoints NFSv4.1/pNFS: Don't return NFS4ERR_DELAY unnecessarily in CB_LAYOUTRECALL NFSv4.1/pNFS: Ensure we enforce RFC5661 Section 12.5.5.2.1 pNFS: If we have to delay the layout callback, mark the layout for return NFSv4.1/pNFS: Add a helper to mark the layout as returned pNFS: Ensure nfs4_layoutget_prepare returns the correct error
2015-12-31NFS/pNFS: Fix up pNFS write reschedule layering violations and bugsTrond Myklebust1-12/+1
The flexfiles layout in particular, seems to want to poke around in the O_DIRECT flags when retransmitting. This patch sets up an interface to allow it to call back into O_DIRECT to handle retransmission correctly. It also fixes a potential bug whereby we could change the behaviour of O_DIRECT if an error is already pending. Signed-off-by: Trond Myklebust <[email protected]>
2015-12-30pNFS/flexfiles: Fix an Oopsable typo in ff_mirror_match_fh()Trond Myklebust1-1/+1
Jeff reports seeing an Oops in ff_layout_alloc_lseg. Turns out copy+paste has played cruel tricks on a nested loop. Reported-by: Jeff Layton <[email protected]> Cc: [email protected] # 4.3+ Signed-off-by: Trond Myklebust <[email protected]>
2015-12-28pNFS/flexfiles: Ensure we record layoutstats even if RPC is terminated earlyTrond Myklebust1-6/+31
Currently, we will only record the layoutstats correctly if the RPC call successfully obtains a slot. If we exit before that happens, then we may find ourselves starting the busy timer through the call in ff_layout_(read|write)_prepare_layoutstats, but never stopping it. The same thing happens if we're doing DA-DS. The fix is to ensure that we catch these cases in the rpc_release() callback. Signed-off-by: Trond Myklebust <[email protected]>
2015-12-28pNFS: Add flag to track if we've called nfs4_ff_layout_stat_io_start_read/writeTrond Myklebust1-25/+70
Signed-off-by: Trond Myklebust <[email protected]>
2015-12-28pNFS/flexfiles: Fix a statistics gathering imbalanceTrond Myklebust1-1/+1
When we replay a failed read, write or commit to the dataserver, we need to ensure that we call ff_layout_read_prepare_v3(), ff_layout_write_prepare_v3 or ff_layout_commit_prepare_v3() so that we reset the statistics. Signed-off-by: Trond Myklebust <[email protected]>
2015-12-28pNFS/flexfiles: Don't prevent flexfiles client from retrying LAYOUTGETTrond Myklebust2-16/+4
Fix a bug in which flexfiles clients are falling back to I/O through the MDS even when the FF_FLAGS_NO_IO_THRU_MDS flag is set. The flexfiles client will always report errors through the LAYOUTRETURN and/or LAYOUTERROR mechanisms, so it should normally be safe for it to retry the LAYOUTGET until it fails or succeeds. Signed-off-by: Trond Myklebust <[email protected]>
2015-12-28pnfs/flexfiles: count io stat in rpc_count_stats callbackPeng Tao1-12/+10
If client ever restarts IO due to some errors, we'll endup mis-counting IO stats if we do the counting in .rpc_done callback. Move it to .rpc_count_stats callback that is only called when releasing RPC. Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-12-28pnfs/flexfiles: do not mark delay-like status as DS failurePeng Tao1-1/+8
We just need to delay and retry in these cases. Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-12-28NFS41: pop some layoutget errors to applicationPeng Tao1-3/+22
For ERESTARTSYS/EIO/EROFS/ENOSPC/E2BIG in layoutget, we should just bail out instead of hiding the error and retrying inband IO. Change all the call sites to pop the error all the way up. Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-12-28pNFS/flexfiles: Support server-supplied layoutstats sampling periodTrond Myklebust2-3/+14
Some servers want to be able to control the frequency with which clients report layoutstats, for instance, in order to monitor QoS for a particular file or set of file. In order to support this, the flexfiles layout allows the server to pass this info as a hint in the layout payload. Signed-off-by: Trond Myklebust <[email protected]>
2015-11-02pNFS/flexfiles: Add support for FF_FLAGS_NO_IO_THRU_MDSTrond Myklebust2-2/+23
For loosely coupled pNFS/flexfiles systems, there is often no advantage at all in going through the MDS for I/O, since the MDS is subject to the same limitations as all other clients when talking to DSes. If a DS is unresponsive, I/O through the MDS will fail. For such systems, the only scalable solution is to have the pNFS clients retry doing pNFS, and so the protocol now provides a flag that allows the pNFS server to signal this. If LAYOUTGET returns FF_FLAGS_NO_IO_THRU_MDS, then we should assume that the MDS wants the client to retry using these devices, even if they were previously marked as being unavailable. To do so, we add a helper, ff_layout_mark_devices_valid() that will be called from layoutget. Signed-off-by: Trond Myklebust <[email protected]>
2015-11-02pNFS/flexfiles: When mirrored, retry failed reads by switching mirrorsTrond Myklebust1-8/+14
If the pNFS/flexfiles file is mirrored, and a read to one mirror fails, then we should bump the mirror index, so that we retry to a different mirror. Once we've iterated through all mirrors and all failed, we can return the layout and issue a new LAYOUTGET. Signed-off-by: Trond Myklebust <[email protected]>
2015-09-02NFSv4.1/flexfiles: Clean up ff_layout_write_done_cb/ff_layout_commit_done_cbTrond Myklebust1-11/+9
Signed-off-by: Trond Myklebust <[email protected]>
2015-09-02NFSv4.1/flexfiles: Mark the layout for return in ff_layout_io_track_ds_error()Trond Myklebust1-9/+1
When I/O cannot complete due to a fatal error on the DS, ensure that we invalidate the corresponding layout segment and return it. Signed-off-by: Trond Myklebust <[email protected]>
2015-09-01NFSv4.1/flexfiles: Mark layout for return if the mirrors are invalidTrond Myklebust1-15/+30
If a read-write layout has an invalid mirror, then we should mark it as invalid, and return it. If a read-only layout has an invalid mirror, then mark it as invalid and check if there is still at least one valid mirror before we return it. Note: Also fix incorrect use of pnfs_generic_mark_devid_invalid(). We really want nfs4_mark_deviceid_unavailable(). Signed-off-by: Trond Myklebust <[email protected]>
2015-09-01NFSv4.1/flexfiles: RW layouts are valid only if all mirrors are validTrond Myklebust1-2/+28
Unlike read layouts, the writeable layout cannot fall back to using only one of the mirrors. It need to write to all of them. Signed-off-by: Trond Myklebust <[email protected]>
2015-09-01NFSv4.1/flexfiles: Fix incorrect usage of pnfs_generic_mark_devid_invalid()Trond Myklebust1-2/+2
Unlike the files layout, flexfiles does not test for the NFS_DEVICEID_INVALID flag. Instead it relies on NFS_DEVICEID_UNAVAILABLE. Fix is to replace with nfs4_mark_deviceid_unavailable(). Signed-off-by: Trond Myklebust <[email protected]>
2015-09-01NFSv4.1/flexfiles: Fix freeing of mirrorsTrond Myklebust1-12/+2
Mirrors are now shared objects, so we should not be freeing them directly inside ff_layout_free_lseg(). We should already be doing the right thing in _ff_layout_free_lseg(), so just let it handle things. Also ensure that ff_layout_free_mirror() frees the RPC credential if it is set. Fixes: 28a0d72c6867 ("Add refcounting to struct nfs4_ff_layout_mirror") Signed-off-by: Trond Myklebust <[email protected]>
2015-08-30NFSv4.1/flexfiles: Don't mark the entire deviceid as bad for file errorsTrond Myklebust1-8/+16
If the file was fenced and/or has been deleted on the DS, then we want to retry pNFS after a layoutreturn with error report. If the server cannot fix the problem, then we rely on it to tell us so in the response to the LAYOUTGET. Signed-off-by: Trond Myklebust <[email protected]>
2015-08-27NFSv4.1/flexfiles: Fix a protocol error in layoutreturnTrond Myklebust1-2/+5
According to the flexfiles protocol, the layoutreturn should specify an array of errors in the following format: struct ff_ioerr4 { offset4 ffie_offset; length4 ffie_length; stateid4 ffie_stateid; device_error4 ffie_errors<>; }; This patch fixes up the code to ensure that our ffie_errors is indeed encoded as an array (albeit with only a single entry). Reported-by: Tom Haynes <[email protected]> Cc: [email protected] Signed-off-by: Trond Myklebust <[email protected]>
2015-08-25NFSv4.1/flexfiles: Allow coalescing of new layout segments and existing onesTrond Myklebust1-0/+60
In order to ensure atomicity of updates, we merge the old layout segments into the new ones, and then invalidate the old ones. Also ensure that we order the list of layout segments so that RO segments are preferred over RW. Signed-off-by: Trond Myklebust <[email protected]>
2015-08-25NFSv4.1/flexfile: ff_layout_remove_mirror can be statickbuild test robot1-1/+1
Signed-off-by: Fengguang Wu <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-08-25NFSv4.2/pnfs: Make the layoutstats timer configurableTrond Myklebust1-1/+4
Allow advanced users to set the layoutstats timer in order to lengthen or shorten the period between layoutstat transmissions to the server. Signed-off-by: Trond Myklebust <[email protected]>
2015-08-25NFSv4.1/flexfile: Ensure uniqueness of mirrors across layout segmentsTrond Myklebust2-29/+99
Keep the full list of mirrors in the struct nfs4_ff_layout_mirror so that they can be shared among the layout segments that use them. Also ensure that we send out only one copy of the layoutstats per mirror. Signed-off-by: Trond Myklebust <[email protected]>
2015-08-25NFSv4.1/flexfiles: Remove mirror backpointer to lseg.Trond Myklebust2-14/+12
When we start sharing mirrors between several lsegs, we won't be able to keep it. Signed-off-by: Trond Myklebust <[email protected]>
2015-08-25NFSv4.1/flexfiles: Add refcounting to struct nfs4_ff_layout_mirrorTrond Myklebust2-9/+28
We do want to share mirrors between layout segments, so add a refcount to enable that. Signed-off-by: Trond Myklebust <[email protected]>
2015-08-25NFS41/flexfiles: zero out DS write wccPeng Tao1-0/+2
We do not want to update inode attributes with DS values. Cc: [email protected] # v4.0+ Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-08-20NFSv4.1/pnfs Ensure flexfiles reports all connection related errorsTrond Myklebust1-13/+35
Make sure that we also handle RPC level connection and protocol negotiation errors. Reported-by: Tom Haynes <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-08-20NFSv4.1/pnfs: Ensure the flexfiles layoutstats timers are consistentTrond Myklebust1-27/+24
We want to ensure that the stopwatches for the busy timer and the aggregate timer are consistent. This means that they need to use the same start/stop times. Signed-off-by: Trond Myklebust <[email protected]>
2015-08-19NFS41/flexfiles: update inode after write finishesPeng Tao1-0/+3
Otherwise we break fstest case tests/read_write/mctime.t Does files layout need the same fix as well? Cc: [email protected] # v4.0+ Cc: Anna Schumaker <[email protected]> Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-08-17nfs: remove some dead code in ff_layout_pg_get_mirror_count_writeJeff Layton1-2/+0
We already know that pg_lseg is NULL here. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-08-12NFSv4.2/pnfs: Use GFP_NOIO for layoutstat reporting in the writeback pathTrond Myklebust1-2/+4
Prevent a potential deadlock. Signed-off-by: Trond Myklebust <[email protected]>
2015-08-12pnfs/flexfiles: LAYOUTSTATS ii_count should be ops instead of bytesPeng Tao1-3/+2
Turned out I misinterpreted the spec... Cc: Tom Haynes <[email protected]> Reported-by: Jean Spector <[email protected]> Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-07-08NFSv4.2/flexfiles: Fix a typo in the flexfiles layoutstats codeTrond Myklebust1-1/+1
Signed-off-by: Trond Myklebust <[email protected]>
2015-06-26pNFS/flexfiles: Fix the reset of struct pgio_header when resendingTrond Myklebust1-1/+1
hdr->good_bytes needs to be set to the length of the request, not zero. Cc: [email protected] # 4.0+ Signed-off-by: Trond Myklebust <[email protected]>
2015-06-26pNFS/flexfiles: Turn off layoutcommit for servers that don't need itTrond Myklebust2-1/+18
This patch ensures that we record the value of 'ffl_flags' from the layout, and then checks for the presence of the FF_FLAGS_NO_LAYOUTCOMMIT flag before deciding whether or not to call pnfs_set_layoutcommit(). The effect is that servers now can decide whether or not they want the client to call layoutcommit before returning a writeable layout. Signed-off-by: Trond Myklebust <[email protected]>
2015-06-26Merge branch 'layoutstats'Trond Myklebust2-13/+470
* layoutstats: pnfs/flexfiles: protect ktime manipulation with mirror lock nfs: provide pnfs_report_layoutstat when NFS42 is disabled pnfs/flexfiles: report layoutstat regularly nfs42: serialize LAYOUTSTATS calls of the same file pnfs/flexfiles: encode LAYOUTSTATS flexfiles specific data pnfs/flexfiles: add ff_layout_prepare_layoutstats pNFS/flexfiles: track when layout is first used pNFS/flexfiles: add layoutstats tracking pNFS/flexfiles: Remove unused struct members user_name, group_name pnfs: add pnfs_report_layoutstat helper function pNFS: fill in nfs42_layoutstat_ops NFSv.2/pnfs Add a LAYOUTSTATS rpc function
2015-06-26pnfs/flexfiles: protect ktime manipulation with mirror lockPeng Tao1-19/+12
It looks as if xchg() and cmpxchg() are not available for 64-bit integers on sparc32: > New breakage seen in linux-next today: > > ERROR: "__xchg_called_with_bad_pointer" [fs/nfs/flexfilelayout/nfs_layout_flexfiles.ko] undefined! > ERROR: "__cmpxchg_called_with_bad_pointer" [fs/nfs/flexfilelayout/nfs_layout_flexfiles.ko] undefined! > make[2]: *** [__modpost] Error 1 > make[1]: *** [modules] Error 2 Given that mirror ktime manipulation is already under mirror->lock, let's make use of the fact. Reported-by: Paul Gortmaker <[email protected]> Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-06-25nfs: always update creds in mirror, even when we have an already connected dsJeff Layton1-2/+2
A ds can be associated with more than one mirror, but we currently skip setting a mirror's credentials if we find that it's already set up with a connected client. The upshot is that we can end up sending DS writes with MDS credentials instead of properly setting them up. Fix nfs4_ff_layout_prepare_ds to always verify that the mirror's credentials are set up, even when we have a DS that's already connected. Reported-by: Tom Haynes <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Cc: [email protected] # 4.0+ Signed-off-by: Trond Myklebust <[email protected]>
2015-06-25nfs: fix potential credential leak in ff_layout_update_mirror_credJeff Layton1-1/+2
If we have two tasks racing to update a mirror's credentials, then they can end up leaking one (or more) sets of credentials. The first task will set mirror->cred and then the second task will just overwrite it. Use a cmpxchg to ensure that the creds are only set once. If we get to the point where we would set mirror->cred and find that they're already set, then we just release the creds that were just found. Signed-off-by: Jeff Layton <[email protected]> Cc: [email protected] # 4.0+ Signed-off-by: Trond Myklebust <[email protected]>
2015-06-24pnfs/flexfiles: report layoutstat regularlyPeng Tao2-5/+28
As a simple scheme, report every minute if IO is still going on. Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-06-24pnfs/flexfiles: encode LAYOUTSTATS flexfiles specific dataPeng Tao2-2/+177
Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-06-24pnfs/flexfiles: add ff_layout_prepare_layoutstatsPeng Tao1-0/+71
It fills in the generic part of LAYOUTSTATS call. One thing to note is that we don't really track if IO is continuous or not. So just fake to use the completed bytes for it. Still missing flexfiles specific part, which will be included in the next patch. Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-06-24pNFS/flexfiles: track when layout is first usedPeng Tao2-3/+8
So that we can report cumulative time since the beginning of statistics collection of the layout. Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Peng Tao <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-06-24pNFS/flexfiles: add layoutstats trackingTrond Myklebust2-11/+203
Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2015-06-24pNFS/flexfiles: Remove unused struct members user_name, group_nameTrond Myklebust1-2/+0
Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>