diff options
author | Andy Adamson <andros@netapp.com> | 2011-02-28 20:34:22 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-03-11 15:38:43 -0500 |
commit | 568e8c494ded95a28c5dd8b79b4d3ffb95b6d845 (patch) | |
tree | 00e71f79575635c0ddfcd1210e263088cc121da2 /fs/nfs/nfs4filelayoutdev.c | |
parent | ea8eecdd11ee6becd09c095c8efa88aa7df95961 (diff) |
NFSv4.1: turn off pNFS on ds connection failure
If a data server is unavailable, go through MDS.
Mark the deviceid containing the data server as a negative cache entry.
Do not try to connect to any data server on a deviceid marked as a negative
cache entry. Mark any layout that tries to use the marked deviceid as failed.
Inodes with a layout marked as fails will not use the layout for I/O, and will
not perform any more layoutgets.
Inodes without a layout will still do layoutget, but the layout will get
marked immediately.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4filelayoutdev.c')
-rw-r--r-- | fs/nfs/nfs4filelayoutdev.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index f594ca35a996..68143c162e3b 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
@@ -606,6 +606,21 @@ nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j) | |||
606 | return flseg->fh_array[i]; | 606 | return flseg->fh_array[i]; |
607 | } | 607 | } |
608 | 608 | ||
609 | static void | ||
610 | filelayout_mark_devid_negative(struct nfs4_file_layout_dsaddr *dsaddr, | ||
611 | int err, u32 ds_addr) | ||
612 | { | ||
613 | u32 *p = (u32 *)&dsaddr->deviceid; | ||
614 | |||
615 | printk(KERN_ERR "NFS: data server %x connection error %d." | ||
616 | " Deviceid [%x%x%x%x] marked out of use.\n", | ||
617 | ds_addr, err, p[0], p[1], p[2], p[3]); | ||
618 | |||
619 | spin_lock(&filelayout_deviceid_lock); | ||
620 | dsaddr->flags |= NFS4_DEVICE_ID_NEG_ENTRY; | ||
621 | spin_unlock(&filelayout_deviceid_lock); | ||
622 | } | ||
623 | |||
609 | struct nfs4_pnfs_ds * | 624 | struct nfs4_pnfs_ds * |
610 | nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx) | 625 | nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx) |
611 | { | 626 | { |
@@ -619,13 +634,18 @@ nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx) | |||
619 | } | 634 | } |
620 | 635 | ||
621 | if (!ds->ds_clp) { | 636 | if (!ds->ds_clp) { |
637 | struct nfs_server *s = NFS_SERVER(lseg->pls_layout->plh_inode); | ||
622 | int err; | 638 | int err; |
623 | 639 | ||
624 | err = nfs4_ds_connect(NFS_SERVER(lseg->pls_layout->plh_inode), | 640 | if (dsaddr->flags & NFS4_DEVICE_ID_NEG_ENTRY) { |
625 | dsaddr->ds_list[ds_idx]); | 641 | /* Already tried to connect, don't try again */ |
642 | dprintk("%s Deviceid marked out of use\n", __func__); | ||
643 | return NULL; | ||
644 | } | ||
645 | err = nfs4_ds_connect(s, ds); | ||
626 | if (err) { | 646 | if (err) { |
627 | printk(KERN_ERR "%s nfs4_ds_connect error %d\n", | 647 | filelayout_mark_devid_negative(dsaddr, err, |
628 | __func__, err); | 648 | ntohl(ds->ds_ip_addr)); |
629 | return NULL; | 649 | return NULL; |
630 | } | 650 | } |
631 | } | 651 | } |