aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r--fs/nfs/pnfs.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 171662114fdd..00b128241746 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -619,6 +619,51 @@ out_err_free:
619 return NULL; 619 return NULL;
620} 620}
621 621
622/* Initiates a LAYOUTRETURN(FILE) */
623int
624_pnfs_return_layout(struct inode *ino)
625{
626 struct pnfs_layout_hdr *lo = NULL;
627 struct nfs_inode *nfsi = NFS_I(ino);
628 LIST_HEAD(tmp_list);
629 struct nfs4_layoutreturn *lrp;
630 nfs4_stateid stateid;
631 int status = 0;
632
633 dprintk("--> %s\n", __func__);
634
635 spin_lock(&ino->i_lock);
636 lo = nfsi->layout;
637 if (!lo || !mark_matching_lsegs_invalid(lo, &tmp_list, NULL)) {
638 spin_unlock(&ino->i_lock);
639 dprintk("%s: no layout segments to return\n", __func__);
640 goto out;
641 }
642 stateid = nfsi->layout->plh_stateid;
643 /* Reference matched in nfs4_layoutreturn_release */
644 get_layout_hdr(lo);
645 spin_unlock(&ino->i_lock);
646 pnfs_free_lseg_list(&tmp_list);
647
648 WARN_ON(test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags));
649
650 lrp = kzalloc(sizeof(*lrp), GFP_KERNEL);
651 if (unlikely(lrp == NULL)) {
652 status = -ENOMEM;
653 goto out;
654 }
655
656 lrp->args.stateid = stateid;
657 lrp->args.layout_type = NFS_SERVER(ino)->pnfs_curr_ld->id;
658 lrp->args.inode = ino;
659 lrp->clp = NFS_SERVER(ino)->nfs_client;
660
661 status = nfs4_proc_layoutreturn(lrp);
662out:
663 dprintk("<-- %s status: %d\n", __func__, status);
664 return status;
665}
666
622bool pnfs_roc(struct inode *ino) 667bool pnfs_roc(struct inode *ino)
623{ 668{
624 struct pnfs_layout_hdr *lo; 669 struct pnfs_layout_hdr *lo;