Commit 30ae2412 authored by Fred Isaman's avatar Fred Isaman Committed by Trond Myklebust

pnfs: Fix manipulation of NFS_LAYOUT_FIRST_LAYOUTGET

The flag was not always being cleared after LAYOUTGET on OPEN.
Signed-off-by: default avatarFred Isaman <fred.isaman@gmail.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent c49b5209
...@@ -1249,8 +1249,7 @@ static void nfs4_opendata_free(struct kref *kref) ...@@ -1249,8 +1249,7 @@ static void nfs4_opendata_free(struct kref *kref)
struct nfs4_opendata, kref); struct nfs4_opendata, kref);
struct super_block *sb = p->dentry->d_sb; struct super_block *sb = p->dentry->d_sb;
if (p->lgp) nfs4_lgopen_release(p->lgp);
nfs4_layoutget_release(p->lgp);
nfs_free_seqid(p->o_arg.seqid); nfs_free_seqid(p->o_arg.seqid);
nfs4_sequence_free_slot(&p->o_res.seq_res); nfs4_sequence_free_slot(&p->o_res.seq_res);
if (p->state != NULL) if (p->state != NULL)
......
...@@ -2129,13 +2129,11 @@ void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp, ...@@ -2129,13 +2129,11 @@ void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp,
lgp->args.inode = ino; lgp->args.inode = ino;
} else } else
lo = NFS_I(lgp->args.inode)->layout; lo = NFS_I(lgp->args.inode)->layout;
pnfs_get_layout_hdr(lo);
if (read_seqcount_retry(&srv->nfs_client->cl_callback_count, if (read_seqcount_retry(&srv->nfs_client->cl_callback_count,
lgp->callback_count)) lgp->callback_count))
goto out; return;
lseg = pnfs_layout_process(lgp); lseg = pnfs_layout_process(lgp);
atomic_dec(&lo->plh_outstanding);
if (IS_ERR(lseg)) { if (IS_ERR(lseg)) {
/* ignore lseg, but would like to mark not to try lgopen */ /* ignore lseg, but would like to mark not to try lgopen */
/* clear some lo flags - first and fail ???? */ /* clear some lo flags - first and fail ???? */
...@@ -2144,9 +2142,19 @@ void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp, ...@@ -2144,9 +2142,19 @@ void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp,
pnfs_layout_clear_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode)); pnfs_layout_clear_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode));
pnfs_put_lseg(lseg); pnfs_put_lseg(lseg);
} }
out: }
pnfs_clear_first_layoutget(lo);
pnfs_put_layout_hdr(lo); void nfs4_lgopen_release(struct nfs4_layoutget *lgp)
{
if (lgp != NULL) {
struct inode *inode = lgp->args.inode;
if (inode) {
struct pnfs_layout_hdr *lo = NFS_I(inode)->layout;
atomic_dec(&lo->plh_outstanding);
pnfs_clear_first_layoutget(lo);
}
pnfs_layoutget_free(lgp);
}
} }
struct pnfs_layout_segment * struct pnfs_layout_segment *
......
...@@ -384,6 +384,7 @@ void pnfs_lgopen_prepare(struct nfs4_opendata *data, ...@@ -384,6 +384,7 @@ void pnfs_lgopen_prepare(struct nfs4_opendata *data,
struct nfs_open_context *ctx); struct nfs_open_context *ctx);
void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp, void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp,
struct nfs_open_context *ctx); struct nfs_open_context *ctx);
void nfs4_lgopen_release(struct nfs4_layoutget *lgp);
static inline bool nfs_have_layout(struct inode *inode) static inline bool nfs_have_layout(struct inode *inode)
{ {
...@@ -795,6 +796,11 @@ static inline void pnfs_parse_lgopen(struct inode *ino, ...@@ -795,6 +796,11 @@ static inline void pnfs_parse_lgopen(struct inode *ino,
struct nfs_open_context *ctx) struct nfs_open_context *ctx)
{ {
} }
static inline void nfs4_lgopen_release(struct nfs4_layoutget *lgp)
{
}
#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4_1 */
#if IS_ENABLED(CONFIG_NFS_V4_2) #if IS_ENABLED(CONFIG_NFS_V4_2)
......
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