linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] fs/9p: Properly update inode attributes on link
@ 2011-03-01  8:51 Aneesh Kumar K.V
  2011-03-01  8:51 ` [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation Aneesh Kumar K.V
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Aneesh Kumar K.V @ 2011-03-01  8:51 UTC (permalink / raw)
  To: v9fs-developer; +Cc: linux-fsdevel, linux-kernel, Aneesh Kumar K.V

With caching enabled, we need to make sure we don't
update inode->i_size via stat2inode because we could
have dirty data which is not yet written to the server

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/9p/vfs_inode.c      |    4 +++-
 fs/9p/vfs_inode_dotl.c |   10 +---------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index e5cd2c4..64f2e4e 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -1295,8 +1295,10 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
 	sprintf(name, "%d\n", oldfid->fid);
 	retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name);
 	__putname(name);
-	if (!retval)
+	if (!retval) {
+		v9fs_refresh_inode(oldfid, old_dentry->d_inode);
 		v9fs_invalidate_inode_attr(dir);
+	}
 clunk_fid:
 	p9_client_clunk(oldfid);
 	return retval;
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 5d66a21..2826026 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -674,19 +674,11 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
 	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
 		/* Get the latest stat info from server. */
 		struct p9_fid *fid;
-		struct p9_stat_dotl *st;
-
 		fid = v9fs_fid_lookup(old_dentry);
 		if (IS_ERR(fid))
 			return PTR_ERR(fid);
 
-		st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
-		if (IS_ERR(st))
-			return PTR_ERR(st);
-
-		v9fs_stat2inode_dotl(st, old_dentry->d_inode);
-
-		kfree(st);
+		v9fs_refresh_inode_dotl(fid, old_dentry->d_inode);
 	}
 	ihold(old_dentry->d_inode);
 	d_instantiate(dentry, old_dentry->d_inode);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation
  2011-03-01  8:51 [PATCH 1/6] fs/9p: Properly update inode attributes on link Aneesh Kumar K.V
@ 2011-03-01  8:51 ` Aneesh Kumar K.V
  2011-03-01 12:10   ` Christoph Hellwig
  2011-03-01  8:51 ` [PATCH 3/6] fs/9p: Writeback dirty data before setattr Aneesh Kumar K.V
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Aneesh Kumar K.V @ 2011-03-01  8:51 UTC (permalink / raw)
  To: v9fs-developer; +Cc: linux-fsdevel, linux-kernel, Aneesh Kumar K.V

We need to call vmtruncate before 9p setattr operation, otherwise we
could write back some dirty pages between setattr with ATTR_SIZE and vmtruncate
causing some truncated pages to be written back to server

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/9p/vfs_inode.c      |   10 ++++------
 fs/9p/vfs_inode_dotl.c |    9 ++++-----
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 64f2e4e..7c60011 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -996,18 +996,16 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
 		if (iattr->ia_valid & ATTR_GID)
 			wstat.n_gid = iattr->ia_gid;
 	}
-
-	retval = p9_client_wstat(fid, &wstat);
-	if (retval < 0)
-		return retval;
-
-	v9fs_invalidate_inode_attr(dentry->d_inode);
 	if ((iattr->ia_valid & ATTR_SIZE) &&
 	    iattr->ia_size != i_size_read(dentry->d_inode)) {
 		retval = vmtruncate(dentry->d_inode, iattr->ia_size);
 		if (retval)
 			return retval;
 	}
+	retval = p9_client_wstat(fid, &wstat);
+	if (retval < 0)
+		return retval;
+	v9fs_invalidate_inode_attr(dentry->d_inode);
 
 	setattr_copy(dentry->d_inode, iattr);
 	mark_inode_dirty(dentry->d_inode);
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 2826026..b14d740 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -456,17 +456,16 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
 	if (IS_ERR(fid))
 		return PTR_ERR(fid);
 
-	retval = p9_client_setattr(fid, &p9attr);
-	if (retval < 0)
-		return retval;
-
-	v9fs_invalidate_inode_attr(dentry->d_inode);
 	if ((iattr->ia_valid & ATTR_SIZE) &&
 	    iattr->ia_size != i_size_read(dentry->d_inode)) {
 		retval = vmtruncate(dentry->d_inode, iattr->ia_size);
 		if (retval)
 			return retval;
 	}
+	retval = p9_client_setattr(fid, &p9attr);
+	if (retval < 0)
+		return retval;
+	v9fs_invalidate_inode_attr(dentry->d_inode);
 
 	setattr_copy(dentry->d_inode, iattr);
 	mark_inode_dirty(dentry->d_inode);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/6] fs/9p: Writeback dirty data before setattr
  2011-03-01  8:51 [PATCH 1/6] fs/9p: Properly update inode attributes on link Aneesh Kumar K.V
  2011-03-01  8:51 ` [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation Aneesh Kumar K.V
@ 2011-03-01  8:51 ` Aneesh Kumar K.V
  2011-03-01  8:51 ` [PATCH 4/6] fs/9p: Make the writeback_fid owned by root Aneesh Kumar K.V
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Aneesh Kumar K.V @ 2011-03-01  8:51 UTC (permalink / raw)
  To: v9fs-developer; +Cc: linux-fsdevel, linux-kernel, Aneesh Kumar K.V

change file attribute can result in making the file readonly.
So flush the dirty pages before that.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/9p/vfs_inode.c      |    4 ++++
 fs/9p/vfs_inode_dotl.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 7c60011..e49c592 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -1002,6 +1002,10 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
 		if (retval)
 			return retval;
 	}
+	/* Write all dirty data */
+	if (S_ISREG(dentry->d_inode->i_mode))
+		filemap_write_and_wait(dentry->d_inode->i_mapping);
+
 	retval = p9_client_wstat(fid, &wstat);
 	if (retval < 0)
 		return retval;
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index b14d740..327c578 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -462,6 +462,10 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
 		if (retval)
 			return retval;
 	}
+	/* Write all dirty data */
+	if (S_ISREG(dentry->d_inode->i_mode))
+		filemap_write_and_wait(dentry->d_inode->i_mapping);
+
 	retval = p9_client_setattr(fid, &p9attr);
 	if (retval < 0)
 		return retval;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/6] fs/9p: Make the writeback_fid owned by root
  2011-03-01  8:51 [PATCH 1/6] fs/9p: Properly update inode attributes on link Aneesh Kumar K.V
  2011-03-01  8:51 ` [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation Aneesh Kumar K.V
  2011-03-01  8:51 ` [PATCH 3/6] fs/9p: Writeback dirty data before setattr Aneesh Kumar K.V
@ 2011-03-01  8:51 ` Aneesh Kumar K.V
  2011-03-01  8:51 ` [PATCH 5/6] net/9p: Convert the in the 9p rpc call path to GFP_NOFS Aneesh Kumar K.V
  2011-03-01  8:51 ` [PATCH 6/6] net/9p: Fix compile warning Aneesh Kumar K.V
  4 siblings, 0 replies; 10+ messages in thread
From: Aneesh Kumar K.V @ 2011-03-01  8:51 UTC (permalink / raw)
  To: v9fs-developer; +Cc: linux-fsdevel, linux-kernel, Aneesh Kumar K.V

Changes to make sure writeback fid is owned by root

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/9p/fid.c |   92 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 56 insertions(+), 36 deletions(-)

diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 9d6a5d3..cd63e00 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -125,46 +125,17 @@ err_out:
 	return -ENOMEM;
 }
 
-/**
- * v9fs_fid_lookup - lookup for a fid, try to walk if not found
- * @dentry: dentry to look for fid in
- *
- * Look for a fid in the specified dentry for the current user.
- * If no fid is found, try to create one walking from a fid from the parent
- * dentry (if it has one), or the root dentry. If the user haven't accessed
- * the fs yet, attach now and walk from the root.
- */
-
-struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
+static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry,
+					       uid_t uid, int any)
 {
-	int i, n, l, clone, any, access;
-	u32 uid;
-	struct p9_fid *fid, *old_fid = NULL;
 	struct dentry *ds;
-	struct v9fs_session_info *v9ses;
 	char **wnames, *uname;
+	int i, n, l, clone, access;
+	struct v9fs_session_info *v9ses;
+	struct p9_fid *fid, *old_fid = NULL;
 
 	v9ses = v9fs_inode2v9ses(dentry->d_inode);
 	access = v9ses->flags & V9FS_ACCESS_MASK;
-	switch (access) {
-	case V9FS_ACCESS_SINGLE:
-	case V9FS_ACCESS_USER:
-	case V9FS_ACCESS_CLIENT:
-		uid = current_fsuid();
-		any = 0;
-		break;
-
-	case V9FS_ACCESS_ANY:
-		uid = v9ses->uid;
-		any = 1;
-		break;
-
-	default:
-		uid = ~0;
-		any = 0;
-		break;
-	}
-
 	fid = v9fs_fid_find(dentry, uid, any);
 	if (fid)
 		return fid;
@@ -250,6 +221,45 @@ err_out:
 	return fid;
 }
 
+/**
+ * v9fs_fid_lookup - lookup for a fid, try to walk if not found
+ * @dentry: dentry to look for fid in
+ *
+ * Look for a fid in the specified dentry for the current user.
+ * If no fid is found, try to create one walking from a fid from the parent
+ * dentry (if it has one), or the root dentry. If the user haven't accessed
+ * the fs yet, attach now and walk from the root.
+ */
+
+struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
+{
+	uid_t uid;
+	int  any, access;
+	struct v9fs_session_info *v9ses;
+
+	v9ses = v9fs_inode2v9ses(dentry->d_inode);
+	access = v9ses->flags & V9FS_ACCESS_MASK;
+	switch (access) {
+	case V9FS_ACCESS_SINGLE:
+	case V9FS_ACCESS_USER:
+	case V9FS_ACCESS_CLIENT:
+		uid = current_fsuid();
+		any = 0;
+		break;
+
+	case V9FS_ACCESS_ANY:
+		uid = v9ses->uid;
+		any = 1;
+		break;
+
+	default:
+		uid = ~0;
+		any = 0;
+		break;
+	}
+	return v9fs_fid_lookup_with_uid(dentry, uid, any);
+}
+
 struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
 {
 	struct p9_fid *fid, *ret;
@@ -262,13 +272,24 @@ struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
 	return ret;
 }
 
+static struct p9_fid *v9fs_fid_clone_with_uid(struct dentry *dentry, uid_t uid)
+{
+	struct p9_fid *fid, *ret;
+
+	fid = v9fs_fid_lookup_with_uid(dentry, uid, 0);
+	if (IS_ERR(fid))
+		return fid;
+
+	ret = p9_client_walk(fid, 0, NULL, 1);
+	return ret;
+}
 
 struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
 {
 	int err;
 	struct p9_fid *fid;
 
-	fid = v9fs_fid_clone(dentry);
+	fid = v9fs_fid_clone_with_uid(dentry, 0);
 	if (IS_ERR(fid))
 		goto error_out;
 	/*
@@ -276,7 +297,6 @@ struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
 	 * dirty pages. We always request for the open fid in read-write
 	 * mode so that a partial page write which result in page
 	 * read can work.
-	 * FIXME!!: we should make the fid owned by uid = 0
 	 */
 	err = p9_client_open(fid, O_RDWR);
 	if (err < 0) {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/6] net/9p: Convert the in the 9p rpc call path to GFP_NOFS
  2011-03-01  8:51 [PATCH 1/6] fs/9p: Properly update inode attributes on link Aneesh Kumar K.V
                   ` (2 preceding siblings ...)
  2011-03-01  8:51 ` [PATCH 4/6] fs/9p: Make the writeback_fid owned by root Aneesh Kumar K.V
@ 2011-03-01  8:51 ` Aneesh Kumar K.V
  2011-03-01  8:51 ` [PATCH 6/6] net/9p: Fix compile warning Aneesh Kumar K.V
  4 siblings, 0 replies; 10+ messages in thread
From: Aneesh Kumar K.V @ 2011-03-01  8:51 UTC (permalink / raw)
  To: v9fs-developer; +Cc: linux-fsdevel, linux-kernel, Aneesh Kumar K.V

Without this we can cause reclaim allocation in writepage.

[ 3433.448430] =================================
[ 3433.449117] [ INFO: inconsistent lock state ]
[ 3433.449117] 2.6.38-rc5+ #84
[ 3433.449117] ---------------------------------
[ 3433.449117] inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-R} usage.
[ 3433.449117] kswapd0/505 [HC0[0]:SC0[0]:HE1:SE1] takes:
[ 3433.449117]  (iprune_sem){+++++-}, at: [<ffffffff810ebbab>] shrink_icache_memory+0x45/0x2b1
[ 3433.449117] {RECLAIM_FS-ON-W} state was registered at:
[ 3433.449117]   [<ffffffff8107fe5f>] mark_held_locks+0x52/0x70
[ 3433.449117]   [<ffffffff8107ff02>] lockdep_trace_alloc+0x85/0x9f
[ 3433.449117]   [<ffffffff810d353d>] slab_pre_alloc_hook+0x18/0x3c
[ 3433.449117]   [<ffffffff810d3fd5>] kmem_cache_alloc+0x23/0xa2
[ 3433.449117]   [<ffffffff8127be77>] idr_pre_get+0x2d/0x6f
[ 3433.449117]   [<ffffffff815434eb>] p9_idpool_get+0x30/0xae
[ 3433.449117]   [<ffffffff81540123>] p9_client_rpc+0xd7/0x9b0
[ 3433.449117]   [<ffffffff815427b0>] p9_client_clunk+0x88/0xdb
[ 3433.449117]   [<ffffffff811d56e5>] v9fs_evict_inode+0x3c/0x48
[ 3433.449117]   [<ffffffff810eb511>] evict+0x1f/0x87
[ 3433.449117]   [<ffffffff810eb5c0>] dispose_list+0x47/0xe3
[ 3433.449117]   [<ffffffff810eb8da>] evict_inodes+0x138/0x14f
[ 3433.449117]   [<ffffffff810d90e2>] generic_shutdown_super+0x57/0xe8
[ 3433.449117]   [<ffffffff810d91e8>] kill_anon_super+0x11/0x50
[ 3433.449117]   [<ffffffff811d4951>] v9fs_kill_super+0x49/0xab
[ 3433.449117]   [<ffffffff810d926e>] deactivate_locked_super+0x21/0x46
[ 3433.449117]   [<ffffffff810d9e84>] deactivate_super+0x40/0x44
[ 3433.449117]   [<ffffffff810ef848>] mntput_no_expire+0x100/0x109
[ 3433.449117]   [<ffffffff810f0aeb>] sys_umount+0x2f1/0x31c
[ 3433.449117]   [<ffffffff8102c87b>] system_call_fastpath+0x16/0x1b
[ 3433.449117] irq event stamp: 192941
[ 3433.449117] hardirqs last  enabled at (192941): [<ffffffff81568dcf>] _raw_spin_unlock_irq+0x2b/0x30
[ 3433.449117] hardirqs last disabled at (192940): [<ffffffff810b5f97>] shrink_inactive_list+0x290/0x2f5
[ 3433.449117] softirqs last  enabled at (188470): [<ffffffff8105fd65>] __do_softirq+0x133/0x152
[ 3433.449117] softirqs last disabled at (188455): [<ffffffff8102d7cc>] call_softirq+0x1c/0x28
[ 3433.449117]
[ 3433.449117] other info that might help us debug this:
[ 3433.449117] 1 lock held by kswapd0/505:
[ 3433.449117]  #0:  (shrinker_rwsem){++++..}, at: [<ffffffff810b52e2>] shrink_slab+0x38/0x15f
[ 3433.449117]
[ 3433.449117] stack backtrace:
[ 3433.449117] Pid: 505, comm: kswapd0 Not tainted 2.6.38-rc5+ #84
[ 3433.449117] Call Trace:
[ 3433.449117]  [<ffffffff8107fbce>] ? valid_state+0x17e/0x191
[ 3433.449117]  [<ffffffff81036896>] ? save_stack_trace+0x28/0x45
[ 3433.449117]  [<ffffffff81080426>] ? check_usage_forwards+0x0/0x87
[ 3433.449117]  [<ffffffff8107fcf4>] ? mark_lock+0x113/0x22c
[ 3433.449117]  [<ffffffff8108105f>] ? __lock_acquire+0x37a/0xcf7
[ 3433.449117]  [<ffffffff8107fc0e>] ? mark_lock+0x2d/0x22c
[ 3433.449117]  [<ffffffff81081077>] ? __lock_acquire+0x392/0xcf7
[ 3433.449117]  [<ffffffff810b14d2>] ? determine_dirtyable_memory+0x15/0x28
[ 3433.449117]  [<ffffffff81081a33>] ? lock_acquire+0x57/0x6d
[ 3433.449117]  [<ffffffff810ebbab>] ? shrink_icache_memory+0x45/0x2b1
[ 3433.449117]  [<ffffffff81567d85>] ? down_read+0x47/0x5c
[ 3433.449117]  [<ffffffff810ebbab>] ? shrink_icache_memory+0x45/0x2b1
[ 3433.449117]  [<ffffffff810ebbab>] ? shrink_icache_memory+0x45/0x2b1
[ 3433.449117]  [<ffffffff810b5385>] ? shrink_slab+0xdb/0x15f
[ 3433.449117]  [<ffffffff810b69bc>] ? kswapd+0x574/0x96a
[ 3433.449117]  [<ffffffff810b6448>] ? kswapd+0x0/0x96a
[ 3433.449117]  [<ffffffff810714e2>] ? kthread+0x7d/0x85
[ 3433.449117]  [<ffffffff8102d6d4>] ? kernel_thread_helper+0x4/0x10
[ 3433.449117]  [<ffffffff81569200>] ? restore_args+0x0/0x30
[ 3433.449117]  [<ffffffff81071465>] ? kthread+0x0/0x85
[ 3433.449117]  [<ffffffff8102d6d0>] ? kernel_thread_helper+0x0/0x10

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 net/9p/client.c     |   10 +++++-----
 net/9p/protocol.c   |    6 +++---
 net/9p/trans_fd.c   |    2 +-
 net/9p/trans_rdma.c |    6 +++---
 net/9p/util.c       |    2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index 347ec0c..2ccbf04 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -223,7 +223,7 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
 
 	req = &c->reqs[row][col];
 	if (!req->tc) {
-		req->wq = kmalloc(sizeof(wait_queue_head_t), GFP_KERNEL);
+		req->wq = kmalloc(sizeof(wait_queue_head_t), GFP_NOFS);
 		if (!req->wq) {
 			printk(KERN_ERR "Couldn't grow tag array\n");
 			return ERR_PTR(-ENOMEM);
@@ -233,17 +233,17 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
 				P9_TRANS_PREF_PAYLOAD_SEP) {
 			int alloc_msize = min(c->msize, 4096);
 			req->tc = kmalloc(sizeof(struct p9_fcall)+alloc_msize,
-					GFP_KERNEL);
+					  GFP_NOFS);
 			req->tc->capacity = alloc_msize;
 			req->rc = kmalloc(sizeof(struct p9_fcall)+alloc_msize,
-					GFP_KERNEL);
+					  GFP_NOFS);
 			req->rc->capacity = alloc_msize;
 		} else {
 			req->tc = kmalloc(sizeof(struct p9_fcall)+c->msize,
-					GFP_KERNEL);
+					  GFP_NOFS);
 			req->tc->capacity = c->msize;
 			req->rc = kmalloc(sizeof(struct p9_fcall)+c->msize,
-					GFP_KERNEL);
+					  GFP_NOFS);
 			req->rc->capacity = c->msize;
 		}
 		if ((!req->tc) || (!req->rc)) {
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 2ce515b..8a4084f 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -205,7 +205,7 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
 				if (errcode)
 					break;
 
-				*sptr = kmalloc(len + 1, GFP_KERNEL);
+				*sptr = kmalloc(len + 1, GFP_NOFS);
 				if (*sptr == NULL) {
 					errcode = -EFAULT;
 					break;
@@ -273,7 +273,7 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
 				if (!errcode) {
 					*wnames =
 					    kmalloc(sizeof(char *) * *nwname,
-						    GFP_KERNEL);
+						    GFP_NOFS);
 					if (!*wnames)
 						errcode = -ENOMEM;
 				}
@@ -317,7 +317,7 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
 					*wqids =
 					    kmalloc(*nwqid *
 						    sizeof(struct p9_qid),
-						    GFP_KERNEL);
+						    GFP_NOFS);
 					if (*wqids == NULL)
 						errcode = -ENOMEM;
 				}
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 078eb16..800c55b 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -349,7 +349,7 @@ static void p9_read_work(struct work_struct *work)
 
 		if (m->req->rc == NULL) {
 			m->req->rc = kmalloc(sizeof(struct p9_fcall) +
-						m->client->msize, GFP_KERNEL);
+						m->client->msize, GFP_NOFS);
 			if (!m->req->rc) {
 				m->req = NULL;
 				err = -ENOMEM;
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 17c5ba7..ccac42a 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -425,7 +425,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
 	struct p9_rdma_context *rpl_context = NULL;
 
 	/* Allocate an fcall for the reply */
-	rpl_context = kmalloc(sizeof *rpl_context, GFP_KERNEL);
+	rpl_context = kmalloc(sizeof *rpl_context, GFP_NOFS);
 	if (!rpl_context) {
 		err = -ENOMEM;
 		goto err_close;
@@ -438,7 +438,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
 	 */
 	if (!req->rc) {
 		req->rc = kmalloc(sizeof(struct p9_fcall)+client->msize,
-								GFP_KERNEL);
+				  GFP_NOFS);
 		if (req->rc) {
 			req->rc->sdata = (char *) req->rc +
 						sizeof(struct p9_fcall);
@@ -469,7 +469,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
 	req->rc = NULL;
 
 	/* Post the request */
-	c = kmalloc(sizeof *c, GFP_KERNEL);
+	c = kmalloc(sizeof *c, GFP_NOFS);
 	if (!c) {
 		err = -ENOMEM;
 		goto err_free1;
diff --git a/net/9p/util.c b/net/9p/util.c
index e048701..b84619b 100644
--- a/net/9p/util.c
+++ b/net/9p/util.c
@@ -92,7 +92,7 @@ int p9_idpool_get(struct p9_idpool *p)
 	unsigned long flags;
 
 retry:
-	if (idr_pre_get(&p->pool, GFP_KERNEL) == 0)
+	if (idr_pre_get(&p->pool, GFP_NOFS) == 0)
 		return 0;
 
 	spin_lock_irqsave(&p->lock, flags);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/6] net/9p: Fix compile warning
  2011-03-01  8:51 [PATCH 1/6] fs/9p: Properly update inode attributes on link Aneesh Kumar K.V
                   ` (3 preceding siblings ...)
  2011-03-01  8:51 ` [PATCH 5/6] net/9p: Convert the in the 9p rpc call path to GFP_NOFS Aneesh Kumar K.V
@ 2011-03-01  8:51 ` Aneesh Kumar K.V
  2011-03-19 20:12   ` Geert Uytterhoeven
  4 siblings, 1 reply; 10+ messages in thread
From: Aneesh Kumar K.V @ 2011-03-01  8:51 UTC (permalink / raw)
  To: v9fs-developer; +Cc: linux-fsdevel, linux-kernel, Aneesh Kumar K.V

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 net/9p/trans_common.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/9p/trans_common.c b/net/9p/trans_common.c
index d62b9aa..ca55e3b 100644
--- a/net/9p/trans_common.c
+++ b/net/9p/trans_common.c
@@ -42,8 +42,8 @@ int
 p9_nr_pages(struct p9_req_t *req)
 {
 	int start_page, end_page;
-	start_page =  (unsigned long long)req->tc->pubuf >> PAGE_SHIFT;
-	end_page = ((unsigned long long)req->tc->pubuf + req->tc->pbuf_size +
+	start_page =  (unsigned long)req->tc->pubuf >> PAGE_SHIFT;
+	end_page = ((unsigned long)req->tc->pubuf + req->tc->pbuf_size +
 			PAGE_SIZE - 1) >> PAGE_SHIFT;
 	return end_page - start_page;
 }
@@ -69,8 +69,8 @@ p9_payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len,
 	*pdata_off = (size_t)req->tc->pubuf & (PAGE_SIZE-1);
 
 	if (*pdata_off)
-		first_page_bytes = min((PAGE_SIZE - *pdata_off),
-				req->tc->pbuf_size);
+		first_page_bytes = min(((size_t)PAGE_SIZE - *pdata_off),
+				       req->tc->pbuf_size);
 
 	rpinfo = req->tc->private;
 	pdata_mapped_pages = get_user_pages_fast((unsigned long)req->tc->pubuf,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation
  2011-03-01  8:51 ` [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation Aneesh Kumar K.V
@ 2011-03-01 12:10   ` Christoph Hellwig
  2011-03-01 13:44     ` Aneesh Kumar K. V
  2011-03-01 15:07     ` Aneesh Kumar K. V
  0 siblings, 2 replies; 10+ messages in thread
From: Christoph Hellwig @ 2011-03-01 12:10 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: v9fs-developer, linux-fsdevel, linux-kernel

On Tue, Mar 01, 2011 at 02:21:20PM +0530, Aneesh Kumar K.V wrote:
> We need to call vmtruncate before 9p setattr operation, otherwise we
> could write back some dirty pages between setattr with ATTR_SIZE and vmtruncate
> causing some truncated pages to be written back to server

Please read the documentation.  vmtruncate is deprecated and no new
users may be added at this point.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation
  2011-03-01 12:10   ` Christoph Hellwig
@ 2011-03-01 13:44     ` Aneesh Kumar K. V
  2011-03-01 15:07     ` Aneesh Kumar K. V
  1 sibling, 0 replies; 10+ messages in thread
From: Aneesh Kumar K. V @ 2011-03-01 13:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: v9fs-developer, linux-fsdevel, linux-kernel

On Tue, 1 Mar 2011 07:10:12 -0500, Christoph Hellwig <hch@infradead.org> wrote:
> On Tue, Mar 01, 2011 at 02:21:20PM +0530, Aneesh Kumar K.V wrote:
> > We need to call vmtruncate before 9p setattr operation, otherwise we
> > could write back some dirty pages between setattr with ATTR_SIZE and vmtruncate
> > causing some truncated pages to be written back to server
> 
> Please read the documentation.  vmtruncate is deprecated and no new
> users may be added at this point.
> 

I actually didn't add a new user for vmtruncate. But i did missed the
fact that vmtruncate is deprecated. I will do a new patch to switch to
truncate_setsize.

-aneesh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation
  2011-03-01 12:10   ` Christoph Hellwig
  2011-03-01 13:44     ` Aneesh Kumar K. V
@ 2011-03-01 15:07     ` Aneesh Kumar K. V
  1 sibling, 0 replies; 10+ messages in thread
From: Aneesh Kumar K. V @ 2011-03-01 15:07 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: v9fs-developer, linux-fsdevel, linux-kernel

On Tue, 1 Mar 2011 07:10:12 -0500, Christoph Hellwig <hch@infradead.org> wrote:
> On Tue, Mar 01, 2011 at 02:21:20PM +0530, Aneesh Kumar K.V wrote:
> > We need to call vmtruncate before 9p setattr operation, otherwise we
> > could write back some dirty pages between setattr with ATTR_SIZE and vmtruncate
> > causing some truncated pages to be written back to server
> 
> Please read the documentation.  vmtruncate is deprecated and no new
> users may be added at this point.
> 

How about the below ? I am yet to test this with ltp ftest0* tests .

commit 110414649b3b56e968c70b3db1aba10e95a63043
Author: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Date:   Tue Mar 1 20:33:57 2011 +0530

    fs/9p: Use truncate_setsize instead of vmtruncate
    
    convert vmtruncate usage to truncate_setsize
    
    Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index c6cef24..561c355 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -970,6 +970,10 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
 	struct p9_fid *fid;
 	struct p9_wstat wstat;
 
+	retval = inode_change_ok(dentry->d_inode, iattr);
+	if (retval)
+		return retval;
+
 	P9_DPRINTK(P9_DEBUG_VFS, "\n");
 	retval = -EPERM;
 	v9ses = v9fs_inode2v9ses(dentry->d_inode);
@@ -998,11 +1002,9 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
 			wstat.n_gid = iattr->ia_gid;
 	}
 	if ((iattr->ia_valid & ATTR_SIZE) &&
-	    iattr->ia_size != i_size_read(dentry->d_inode)) {
-		retval = vmtruncate(dentry->d_inode, iattr->ia_size);
-		if (retval)
-			return retval;
-	}
+	    iattr->ia_size != i_size_read(dentry->d_inode))
+		truncate_setsize(dentry->d_inode, iattr->ia_size);
+
 	/* Write all dirty data */
 	if (S_ISREG(dentry->d_inode->i_mode))
 		filemap_write_and_wait(dentry->d_inode->i_mapping);
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 327c578..2e2d377 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -457,11 +457,9 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
 		return PTR_ERR(fid);
 
 	if ((iattr->ia_valid & ATTR_SIZE) &&
-	    iattr->ia_size != i_size_read(dentry->d_inode)) {
-		retval = vmtruncate(dentry->d_inode, iattr->ia_size);
-		if (retval)
-			return retval;
-	}
+	    iattr->ia_size != i_size_read(dentry->d_inode))
+		truncate_setsize(dentry->d_inode, iattr->ia_size);
+
 	/* Write all dirty data */
 	if (S_ISREG(dentry->d_inode->i_mode))
 		filemap_write_and_wait(dentry->d_inode->i_mapping);

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 6/6] net/9p: Fix compile warning
  2011-03-01  8:51 ` [PATCH 6/6] net/9p: Fix compile warning Aneesh Kumar K.V
@ 2011-03-19 20:12   ` Geert Uytterhoeven
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2011-03-19 20:12 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: v9fs-developer, linux-fsdevel, linux-kernel

These warnings?

net/9p/trans_common.c:45: warning: cast from pointer to integer of
different size
net/9p/trans_common.c:46: warning: cast from pointer to integer of
different size
net/9p/trans_common.c:72: warning: comparison of distinct pointer
types lacks a cast

On Tue, Mar 1, 2011 at 09:51, Aneesh Kumar K.V
<aneesh.kumar@linux.vnet.ibm.com> wrote:
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  net/9p/trans_common.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/9p/trans_common.c b/net/9p/trans_common.c
> index d62b9aa..ca55e3b 100644
> --- a/net/9p/trans_common.c
> +++ b/net/9p/trans_common.c
> @@ -42,8 +42,8 @@ int
>  p9_nr_pages(struct p9_req_t *req)
>  {
>        int start_page, end_page;

In addition, the values may not fit in an int on 64-bit. Better use
'unsigned long'.

> -       start_page =  (unsigned long long)req->tc->pubuf >> PAGE_SHIFT;
> -       end_page = ((unsigned long long)req->tc->pubuf + req->tc->pbuf_size +
> +       start_page =  (unsigned long)req->tc->pubuf >> PAGE_SHIFT;
> +       end_page = ((unsigned long)req->tc->pubuf + req->tc->pbuf_size +
>                        PAGE_SIZE - 1) >> PAGE_SHIFT;
>        return end_page - start_page;
>  }
> @@ -69,8 +69,8 @@ p9_payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len,
>        *pdata_off = (size_t)req->tc->pubuf & (PAGE_SIZE-1);
>
>        if (*pdata_off)
> -               first_page_bytes = min((PAGE_SIZE - *pdata_off),
> -                               req->tc->pbuf_size);
> +               first_page_bytes = min(((size_t)PAGE_SIZE - *pdata_off),
> +                                      req->tc->pbuf_size);
>
>        rpinfo = req->tc->private;
>        pdata_mapped_pages = get_user_pages_fast((unsigned long)req->tc->pubuf,
> --
> 1.7.1

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-03-19 20:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01  8:51 [PATCH 1/6] fs/9p: Properly update inode attributes on link Aneesh Kumar K.V
2011-03-01  8:51 ` [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation Aneesh Kumar K.V
2011-03-01 12:10   ` Christoph Hellwig
2011-03-01 13:44     ` Aneesh Kumar K. V
2011-03-01 15:07     ` Aneesh Kumar K. V
2011-03-01  8:51 ` [PATCH 3/6] fs/9p: Writeback dirty data before setattr Aneesh Kumar K.V
2011-03-01  8:51 ` [PATCH 4/6] fs/9p: Make the writeback_fid owned by root Aneesh Kumar K.V
2011-03-01  8:51 ` [PATCH 5/6] net/9p: Convert the in the 9p rpc call path to GFP_NOFS Aneesh Kumar K.V
2011-03-01  8:51 ` [PATCH 6/6] net/9p: Fix compile warning Aneesh Kumar K.V
2011-03-19 20:12   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).