Re: [PATCH] pnfsd-lexp: recall layout on truncate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2011-02-23 09:18, Boaz Harrosh wrote:
> On 02/22/2011 04:09 PM, Benny Halevy wrote:
>> Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx>
>> @@ -384,6 +385,9 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
>>  					NFSD_MAY_TRUNC|NFSD_MAY_OWNER_OVERRIDE);
>>  			if (err)
>>  				goto out;
>> +#if defined(CONFIG_PNFSD_LOCAL_EXPORT)
>> +			pnfsd_lexp_recall_layout(inode);
> 
> Ha, I just realized, this is not good, for when CONFIG_PNFSD_LOCAL_EXPORT is set
> but the actual sb is pnfs-exported by the file system like gfs2 and exofs.
> You need to check if the FS is owned by the PNFSD_LOCAL_EXPORT.

Good point.  Can you please test the following patch?

>From 9afc5e82390fe889aee2770eb217613146ddc9de Mon Sep 17 00:00:00 2001
From: Benny Halevy <bhalevy@xxxxxxxxxxx>
Date: Wed, 23 Feb 2011 09:53:15 -0800
Subject: [PATCH] SQUASHME: pnfsd-lexp: recall layout on truncate only if inode is exported over pnfsd-lexp

Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx>
---
 fs/nfsd/pnfsd.h      |    1 +
 fs/nfsd/pnfsd_lexp.c |    6 ++++++
 fs/nfsd/vfs.c        |    3 ++-
 3 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/pnfsd.h b/fs/nfsd/pnfsd.h
index 51dd982..c11d93d 100644
--- a/fs/nfsd/pnfsd.h
+++ b/fs/nfsd/pnfsd.h
@@ -139,6 +139,7 @@ extern struct sockaddr pnfsd_lexp_addr;
 extern size_t pnfs_lexp_addr_len;
 
 extern void pnfsd_lexp_init(struct inode *);
+extern bool is_inode_pnfsd_lexp(struct inode *);
 extern int pnfsd_lexp_recall_layout(struct inode *);
 #endif /* CONFIG_PNFSD_LOCAL_EXPORT */
 
diff --git a/fs/nfsd/pnfsd_lexp.c b/fs/nfsd/pnfsd_lexp.c
index 736cc3f..71d503e 100644
--- a/fs/nfsd/pnfsd_lexp.c
+++ b/fs/nfsd/pnfsd_lexp.c
@@ -232,6 +232,12 @@ pnfsd_lexp_init(struct inode *inode)
 		init_waitqueue_head(&lo_recall_wq);
 }
 
+bool
+is_inode_pnfsd_lexp(struct inode *inode)
+{
+	return inode->i_sb->s_pnfs_op == &pnfsd_lexp_ops;
+}
+
 static bool
 has_no_layout(struct nfs4_file *fp)
 {
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 021e89e..2a3eff2 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -386,7 +386,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
 			if (err)
 				goto out;
 #if defined(CONFIG_PNFSD_LOCAL_EXPORT)
-			pnfsd_lexp_recall_layout(inode);
+			if (is_inode_pnfsd_lexp(inode))
+				pnfsd_lexp_recall_layout(inode);
 #endif /* CONFIG_PNFSD_LOCAL_EXPORT */
 #if defined(CONFIG_SPNFS_BLOCK)
 			if (pnfs_block_enabled(inode, 0)) {
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux