{
if (!atomic_dec_and_test(&sop->so_count))
return;
+ sop->so_ops->so_unhash(sop);
kfree(sop->so_owner.data);
sop->so_ops->so_free(sop);
}
}
static void unhash_lockowner(struct nfs4_lockowner *lo)
+{
+ list_del_init(&lo->lo_owner.so_strhash);
+}
+
+static void release_lockowner_stateids(struct nfs4_lockowner *lo)
{
struct nfs4_ol_stateid *stp;
- list_del(&lo->lo_owner.so_strhash);
while (!list_empty(&lo->lo_owner.so_stateids)) {
stp = list_first_entry(&lo->lo_owner.so_stateids,
struct nfs4_ol_stateid, st_perstateowner);
static void release_lockowner(struct nfs4_lockowner *lo)
{
unhash_lockowner(lo);
+ release_lockowner_stateids(lo);
nfs4_put_stateowner(&lo->lo_owner);
}
static void unhash_openowner(struct nfs4_openowner *oo)
{
- struct nfs4_ol_stateid *stp;
-
- list_del(&oo->oo_owner.so_strhash);
- list_del(&oo->oo_perclient);
- while (!list_empty(&oo->oo_owner.so_stateids)) {
- stp = list_first_entry(&oo->oo_owner.so_stateids,
- struct nfs4_ol_stateid, st_perstateowner);
- release_open_stateid(stp);
- }
+ list_del_init(&oo->oo_owner.so_strhash);
+ list_del_init(&oo->oo_perclient);
}
static void release_last_closed_stateid(struct nfs4_openowner *oo)
}
}
+static void release_openowner_stateids(struct nfs4_openowner *oo)
+{
+ struct nfs4_ol_stateid *stp;
+
+ while (!list_empty(&oo->oo_owner.so_stateids)) {
+ stp = list_first_entry(&oo->oo_owner.so_stateids,
+ struct nfs4_ol_stateid, st_perstateowner);
+ release_open_stateid(stp);
+ }
+}
+
static void release_openowner(struct nfs4_openowner *oo)
{
unhash_openowner(oo);
+ release_openowner_stateids(oo);
list_del(&oo->oo_close_lru);
release_last_closed_stateid(oo);
nfs4_put_stateowner(&oo->oo_owner);
list_add(&oo->oo_perclient, &clp->cl_openowners);
}
+static void nfs4_unhash_openowner(struct nfs4_stateowner *so)
+{
+ struct nfs4_openowner *oo = openowner(so);
+
+ unhash_openowner(oo);
+}
+
static void nfs4_free_openowner(struct nfs4_stateowner *so)
{
struct nfs4_openowner *oo = openowner(so);
}
static const struct nfs4_stateowner_operations openowner_ops = {
- .so_free = nfs4_free_openowner,
+ .so_unhash = nfs4_unhash_openowner,
+ .so_free = nfs4_free_openowner,
};
static struct nfs4_openowner *
return NULL;
}
+static void nfs4_unhash_lockowner(struct nfs4_stateowner *sop)
+{
+ unhash_lockowner(lockowner(sop));
+}
+
static void nfs4_free_lockowner(struct nfs4_stateowner *sop)
{
struct nfs4_lockowner *lo = lockowner(sop);
}
static const struct nfs4_stateowner_operations lockowner_ops = {
- .so_free = nfs4_free_lockowner,
+ .so_unhash = nfs4_unhash_lockowner,
+ .so_free = nfs4_free_lockowner,
};
/*