Commit 6622c3ea authored by Trond Myklebust's avatar Trond Myklebust

NFSv4.1: Free the pnfs_layout_hdr outside the inode->i_lock

None of the existing pNFS layout drivers seem to require the inode
to be locked while they free the layout header.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 01d39ce8
...@@ -213,7 +213,7 @@ pnfs_free_layout_hdr(struct pnfs_layout_hdr *lo) ...@@ -213,7 +213,7 @@ pnfs_free_layout_hdr(struct pnfs_layout_hdr *lo)
} }
static void static void
destroy_layout_hdr(struct pnfs_layout_hdr *lo) pnfs_detach_layout_hdr(struct pnfs_layout_hdr *lo)
{ {
struct nfs_inode *nfsi = NFS_I(lo->plh_inode); struct nfs_inode *nfsi = NFS_I(lo->plh_inode);
dprintk("%s: freeing layout cache %p\n", __func__, lo); dprintk("%s: freeing layout cache %p\n", __func__, lo);
...@@ -222,14 +222,6 @@ destroy_layout_hdr(struct pnfs_layout_hdr *lo) ...@@ -222,14 +222,6 @@ destroy_layout_hdr(struct pnfs_layout_hdr *lo)
/* Reset MDS Threshold I/O counters */ /* Reset MDS Threshold I/O counters */
nfsi->write_io = 0; nfsi->write_io = 0;
nfsi->read_io = 0; nfsi->read_io = 0;
pnfs_free_layout_hdr(lo);
}
static void
pnfs_put_layout_hdr_locked(struct pnfs_layout_hdr *lo)
{
if (atomic_dec_and_test(&lo->plh_refcount))
destroy_layout_hdr(lo);
} }
void void
...@@ -238,8 +230,9 @@ pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo) ...@@ -238,8 +230,9 @@ pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo)
struct inode *inode = lo->plh_inode; struct inode *inode = lo->plh_inode;
if (atomic_dec_and_lock(&lo->plh_refcount, &inode->i_lock)) { if (atomic_dec_and_lock(&lo->plh_refcount, &inode->i_lock)) {
destroy_layout_hdr(lo); pnfs_detach_layout_hdr(lo);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
pnfs_free_layout_hdr(lo);
} }
} }
...@@ -792,7 +785,11 @@ void pnfs_roc_release(struct inode *ino) ...@@ -792,7 +785,11 @@ void pnfs_roc_release(struct inode *ino)
spin_lock(&ino->i_lock); spin_lock(&ino->i_lock);
lo = NFS_I(ino)->layout; lo = NFS_I(ino)->layout;
lo->plh_block_lgets--; lo->plh_block_lgets--;
pnfs_put_layout_hdr_locked(lo); if (atomic_dec_and_test(&lo->plh_refcount)) {
pnfs_detach_layout_hdr(lo);
spin_unlock(&ino->i_lock);
pnfs_free_layout_hdr(lo);
} else
spin_unlock(&ino->i_lock); spin_unlock(&ino->i_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment