Skip to content

Commit 8adc830

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
pNFS: Add a flag argument to pnfs_destroy_layouts_byclid()
Change the bool argument to a flag so that we can add different modes for doing bulk destroy of a layout. In particular, we will want the ability to schedule return of all the layouts associated with a given NFS server when it reboots. Signed-off-by: Trond Myklebust <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 5d2db08 commit 8adc830

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

fs/nfs/callback_proc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,10 @@ static u32 initiate_bulk_draining(struct nfs_client *clp,
323323
int stat;
324324

325325
if (args->cbl_recall_type == RETURN_FSID)
326-
stat = pnfs_destroy_layouts_byfsid(clp, &args->cbl_fsid, true);
326+
stat = pnfs_layout_destroy_byfsid(clp, &args->cbl_fsid,
327+
PNFS_LAYOUT_BULK_RETURN);
327328
else
328-
stat = pnfs_destroy_layouts_byclid(clp, true);
329+
stat = pnfs_layout_destroy_byclid(clp, PNFS_LAYOUT_BULK_RETURN);
329330
if (stat != 0)
330331
return NFS4ERR_DELAY;
331332
return NFS4ERR_NOMATCHING_LAYOUT;

fs/nfs/pnfs.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ pnfs_layout_bulk_destroy_byserver_locked(struct nfs_client *clp,
868868

869869
static int
870870
pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list,
871-
bool is_bulk_recall)
871+
enum pnfs_layout_destroy_mode mode)
872872
{
873873
struct pnfs_layout_hdr *lo;
874874
struct inode *inode;
@@ -887,7 +887,7 @@ pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list,
887887
spin_lock(&inode->i_lock);
888888
list_del_init(&lo->plh_bulk_destroy);
889889
if (pnfs_mark_layout_stateid_invalid(lo, &lseg_list)) {
890-
if (is_bulk_recall)
890+
if (mode == PNFS_LAYOUT_BULK_RETURN)
891891
set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);
892892
ret = -EAGAIN;
893893
}
@@ -901,10 +901,8 @@ pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list,
901901
return ret;
902902
}
903903

904-
int
905-
pnfs_destroy_layouts_byfsid(struct nfs_client *clp,
906-
struct nfs_fsid *fsid,
907-
bool is_recall)
904+
int pnfs_layout_destroy_byfsid(struct nfs_client *clp, struct nfs_fsid *fsid,
905+
enum pnfs_layout_destroy_mode mode)
908906
{
909907
struct nfs_server *server;
910908
LIST_HEAD(layout_list);
@@ -923,12 +921,11 @@ pnfs_destroy_layouts_byfsid(struct nfs_client *clp,
923921
rcu_read_unlock();
924922
spin_unlock(&clp->cl_lock);
925923

926-
return pnfs_layout_free_bulk_destroy_list(&layout_list, is_recall);
924+
return pnfs_layout_free_bulk_destroy_list(&layout_list, mode);
927925
}
928926

929-
int
930-
pnfs_destroy_layouts_byclid(struct nfs_client *clp,
931-
bool is_recall)
927+
int pnfs_layout_destroy_byclid(struct nfs_client *clp,
928+
enum pnfs_layout_destroy_mode mode)
932929
{
933930
struct nfs_server *server;
934931
LIST_HEAD(layout_list);
@@ -945,7 +942,7 @@ pnfs_destroy_layouts_byclid(struct nfs_client *clp,
945942
rcu_read_unlock();
946943
spin_unlock(&clp->cl_lock);
947944

948-
return pnfs_layout_free_bulk_destroy_list(&layout_list, is_recall);
945+
return pnfs_layout_free_bulk_destroy_list(&layout_list, mode);
949946
}
950947

951948
/*
@@ -958,7 +955,7 @@ pnfs_destroy_all_layouts(struct nfs_client *clp)
958955
nfs4_deviceid_mark_client_invalid(clp);
959956
nfs4_deviceid_purge_client(clp);
960957

961-
pnfs_destroy_layouts_byclid(clp, false);
958+
pnfs_layout_destroy_byclid(clp, PNFS_LAYOUT_INVALIDATE);
962959
}
963960

964961
static void

fs/nfs/pnfs.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ enum layoutdriver_policy_flags {
118118
PNFS_LAYOUTGET_ON_OPEN = 1 << 3,
119119
};
120120

121+
enum pnfs_layout_destroy_mode {
122+
PNFS_LAYOUT_INVALIDATE = 0,
123+
PNFS_LAYOUT_BULK_RETURN,
124+
};
125+
121126
struct nfs4_deviceid_node;
122127

123128
/* Per-layout driver specific registration structure */
@@ -273,11 +278,10 @@ void pnfs_free_lseg_list(struct list_head *tmp_list);
273278
void pnfs_destroy_layout(struct nfs_inode *);
274279
void pnfs_destroy_layout_final(struct nfs_inode *);
275280
void pnfs_destroy_all_layouts(struct nfs_client *);
276-
int pnfs_destroy_layouts_byfsid(struct nfs_client *clp,
277-
struct nfs_fsid *fsid,
278-
bool is_recall);
279-
int pnfs_destroy_layouts_byclid(struct nfs_client *clp,
280-
bool is_recall);
281+
int pnfs_layout_destroy_byfsid(struct nfs_client *clp, struct nfs_fsid *fsid,
282+
enum pnfs_layout_destroy_mode mode);
283+
int pnfs_layout_destroy_byclid(struct nfs_client *clp,
284+
enum pnfs_layout_destroy_mode mode);
281285
bool nfs4_layout_refresh_old_stateid(nfs4_stateid *dst,
282286
struct pnfs_layout_range *dst_range,
283287
struct inode *inode);

0 commit comments

Comments
 (0)