2012-03-13 19:19:21

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 1/1] NFS4: remove erroneous BUG_ONs in file layout pg_init functions

These BUG_ONs assume that pg_init is called once per nfs_pageio_descriptor,
yet it is actually called once per attempted RPC call.

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/nfs4filelayout.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index c7496b6..3c2ee2f 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -757,7 +757,7 @@ void
filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,
struct nfs_page *req)
{
- BUG_ON(pgio->pg_lseg != NULL);
+ struct pnfs_layout_segment *old = pgio->pg_lseg;

pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
req->wb_context,
@@ -765,6 +765,7 @@ filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,
NFS4_MAX_UINT64,
IOMODE_READ,
GFP_KERNEL);
+ put_lseg(old);
/* If no lseg, fall back to read through mds */
if (pgio->pg_lseg == NULL)
nfs_pageio_reset_read_mds(pgio);
@@ -774,7 +775,7 @@ void
filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
struct nfs_page *req)
{
- BUG_ON(pgio->pg_lseg != NULL);
+ struct pnfs_layout_segment *old = pgio->pg_lseg;

pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
req->wb_context,
@@ -782,6 +783,7 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
NFS4_MAX_UINT64,
IOMODE_RW,
GFP_NOFS);
+ put_lseg(old);
/* If no lseg, fall back to write through mds */
if (pgio->pg_lseg == NULL)
nfs_pageio_reset_write_mds(pgio);
--
1.7.2.1



2012-03-13 19:26:08

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH 1/1] NFS4: remove erroneous BUG_ONs in file layout pg_init functions

T24gVHVlLCAyMDEyLTAzLTEzIGF0IDE1OjE5IC0wNDAwLCBGcmVkIElzYW1hbiB3cm90ZToNCj4g
VGhlc2UgQlVHX09OcyBhc3N1bWUgdGhhdCBwZ19pbml0IGlzIGNhbGxlZCBvbmNlIHBlciBuZnNf
cGFnZWlvX2Rlc2NyaXB0b3IsDQo+IHlldCBpdCBpcyBhY3R1YWxseSBjYWxsZWQgb25jZSBwZXIg
YXR0ZW1wdGVkIFJQQyBjYWxsLg0KDQpTaG91bGRuJ3QgdGhlIHBnX2xzZWcgX2Fsd2F5c18gZ2V0
IGNsZWFyZWQgb3V0IGluIHRoZSBwZ19kb2lvIGNhbGxiYWNrPw0KSWYgbm90LCB3ZSByaXNrIGxl
YWtpbmcgbHNlZ3MuDQpJT1c6IEFzIGZhciBhcyBJIGNhbiB0ZWxsLCB0aG9zZSBCVUdfT05zIGFy
ZSBjb3JyZWN0Lg0KDQotLSANClRyb25kIE15a2xlYnVzdA0KTGludXggTkZTIGNsaWVudCBtYWlu
dGFpbmVyDQoNCk5ldEFwcA0KVHJvbmQuTXlrbGVidXN0QG5ldGFwcC5jb20NCnd3dy5uZXRhcHAu
Y29tDQoNCg==