All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate
@ 2018-05-29 15:48 Trond Myklebust
  2018-05-29 18:33 ` Anna Schumaker
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Trond Myklebust @ 2018-05-29 15:48 UTC (permalink / raw)
  To: linux-nfs

If the file being sillyrenamed is being completely deleted, or
we are using NFSv4.0, then we need to return the delegation before
sending off the sillydelete.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/dir.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index b315f53b3aec..ed20ff51f865 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1399,11 +1399,32 @@ EXPORT_SYMBOL_GPL(nfs_lookup);
 #if IS_ENABLED(CONFIG_NFS_V4)
 static int nfs4_lookup_revalidate(struct dentry *, unsigned int);
 
+/*
+ * Called when the dentry loses inode.
+ * We use it to clean up silly-renamed files.
+ */
+static void nfs4_dentry_iput(struct dentry *dentry, struct inode *inode)
+{
+	if (S_ISDIR(inode->i_mode))
+		/* drop any readdir cache as it could easily be old */
+		NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
+
+	if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
+		if (inode->i_nlink == 1)
+			nfs4_inode_return_delegation(inode);
+		else
+			nfs4_inode_make_writeable(inode);
+		nfs_complete_unlink(dentry, inode);
+		nfs_drop_nlink(inode);
+	}
+	iput(inode);
+}
+
 const struct dentry_operations nfs4_dentry_operations = {
 	.d_revalidate	= nfs4_lookup_revalidate,
 	.d_weak_revalidate	= nfs_weak_revalidate,
 	.d_delete	= nfs_dentry_delete,
-	.d_iput		= nfs_dentry_iput,
+	.d_iput		= nfs4_dentry_iput,
 	.d_automount	= nfs_d_automount,
 	.d_release	= nfs_d_release,
 };
-- 
2.17.0


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

* Re: [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate
  2018-05-29 15:48 [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate Trond Myklebust
@ 2018-05-29 18:33 ` Anna Schumaker
  2018-05-29 19:23   ` Trond Myklebust
  2018-06-01  8:47 ` kbuild test robot
  2018-06-01 13:00 ` kbuild test robot
  2 siblings, 1 reply; 5+ messages in thread
From: Anna Schumaker @ 2018-05-29 18:33 UTC (permalink / raw)
  To: Trond Myklebust, linux-nfs

Hi Trond,

On 05/29/2018 11:48 AM, Trond Myklebust wrote:
> If the file being sillyrenamed is being completely deleted, or
> we are using NFSv4.0, then we need to return the delegation before
> sending off the sillydelete.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
>  fs/nfs/dir.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index b315f53b3aec..ed20ff51f865 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -1399,11 +1399,32 @@ EXPORT_SYMBOL_GPL(nfs_lookup);
>  #if IS_ENABLED(CONFIG_NFS_V4)
>  static int nfs4_lookup_revalidate(struct dentry *, unsigned int);
>  
> +/*
> + * Called when the dentry loses inode.
> + * We use it to clean up silly-renamed files.
> + */
> +static void nfs4_dentry_iput(struct dentry *dentry, struct inode *inode)
> +{
> +	if (S_ISDIR(inode->i_mode))
> +		/* drop any readdir cache as it could easily be old */
> +		NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
> +
> +	if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
> +		if (inode->i_nlink == 1)
> +			nfs4_inode_return_delegation(inode);
> +		else
> +			nfs4_inode_make_writeable(inode);

I think these functions need to be exported in delegation.c to avoid undefined symbol warnings from the compiler.

Thanks,
Anna

> +		nfs_complete_unlink(dentry, inode);
> +		nfs_drop_nlink(inode);
> +	}
> +	iput(inode);
> +}
> +
>  const struct dentry_operations nfs4_dentry_operations = {
>  	.d_revalidate	= nfs4_lookup_revalidate,
>  	.d_weak_revalidate	= nfs_weak_revalidate,
>  	.d_delete	= nfs_dentry_delete,
> -	.d_iput		= nfs_dentry_iput,
> +	.d_iput		= nfs4_dentry_iput,
>  	.d_automount	= nfs_d_automount,
>  	.d_release	= nfs_d_release,
>  };
> 

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

* Re: [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate
  2018-05-29 18:33 ` Anna Schumaker
@ 2018-05-29 19:23   ` Trond Myklebust
  0 siblings, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2018-05-29 19:23 UTC (permalink / raw)
  To: linux-nfs, schumaker.anna

T24gVHVlLCAyMDE4LTA1LTI5IGF0IDE0OjMzIC0wNDAwLCBBbm5hIFNjaHVtYWtlciB3cm90ZToN
Cj4gSGkgVHJvbmQsDQo+IA0KPiBPbiAwNS8yOS8yMDE4IDExOjQ4IEFNLCBUcm9uZCBNeWtsZWJ1
c3Qgd3JvdGU6DQo+ID4gSWYgdGhlIGZpbGUgYmVpbmcgc2lsbHlyZW5hbWVkIGlzIGJlaW5nIGNv
bXBsZXRlbHkgZGVsZXRlZCwgb3INCj4gPiB3ZSBhcmUgdXNpbmcgTkZTdjQuMCwgdGhlbiB3ZSBu
ZWVkIHRvIHJldHVybiB0aGUgZGVsZWdhdGlvbiBiZWZvcmUNCj4gPiBzZW5kaW5nIG9mZiB0aGUg
c2lsbHlkZWxldGUuDQo+ID4gDQo+ID4gU2lnbmVkLW9mZi1ieTogVHJvbmQgTXlrbGVidXN0IDx0
cm9uZC5teWtsZWJ1c3RAaGFtbWVyc3BhY2UuY29tPg0KPiA+IC0tLQ0KPiA+ICBmcy9uZnMvZGly
LmMgfCAyMyArKysrKysrKysrKysrKysrKysrKysrLQ0KPiA+ICAxIGZpbGUgY2hhbmdlZCwgMjIg
aW5zZXJ0aW9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ID4gKwkJaWYg
KGlub2RlLT5pX25saW5rID09IDEpDQo+ID4gKwkJCW5mczRfaW5vZGVfcmV0dXJuX2RlbGVnYXRp
b24oaW5vZGUpOw0KPiA+ICsJCWVsc2UNCj4gPiArCQkJbmZzNF9pbm9kZV9tYWtlX3dyaXRlYWJs
ZShpbm9kZSk7DQo+IA0KPiBJIHRoaW5rIHRoZXNlIGZ1bmN0aW9ucyBuZWVkIHRvIGJlIGV4cG9y
dGVkIGluIGRlbGVnYXRpb24uYyB0byBhdm9pZA0KPiB1bmRlZmluZWQgc3ltYm9sIHdhcm5pbmdz
IGZyb20gdGhlIGNvbXBpbGVyLg0KPiANCg0KV2hvb3BzLiBZZXMsIHRoYW5rcyBmb3Igbm90aWNp
bmchDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXIs
IEhhbW1lcnNwYWNlDQp0cm9uZC5teWtsZWJ1c3RAaGFtbWVyc3BhY2UuY29tDQoNCg==

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

* Re: [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate
  2018-05-29 15:48 [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate Trond Myklebust
  2018-05-29 18:33 ` Anna Schumaker
@ 2018-06-01  8:47 ` kbuild test robot
  2018-06-01 13:00 ` kbuild test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2018-06-01  8:47 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: kbuild-all, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]

Hi Trond,

I love your patch! Yet something to improve:

[auto build test ERROR on nfs/linux-next]
[also build test ERROR on v4.17-rc7 next-20180531]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Trond-Myklebust/NFSv4-Fix-sillyrename-to-return-the-delegation-when-appropriate/20180531-232019
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: arm-arm5 (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   fs/nfs/dir.o: In function `nfs4_dentry_iput':
>> dir.c:(.text+0xe04): undefined reference to `nfs4_inode_make_writeable'
>> dir.c:(.text+0xe28): undefined reference to `nfs4_inode_return_delegation'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28498 bytes --]

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

* Re: [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate
  2018-05-29 15:48 [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate Trond Myklebust
  2018-05-29 18:33 ` Anna Schumaker
  2018-06-01  8:47 ` kbuild test robot
@ 2018-06-01 13:00 ` kbuild test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2018-06-01 13:00 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: kbuild-all, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]

Hi Trond,

I love your patch! Yet something to improve:

[auto build test ERROR on nfs/linux-next]
[also build test ERROR on v4.17-rc7 next-20180531]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Trond-Myklebust/NFSv4-Fix-sillyrename-to-return-the-delegation-when-appropriate/20180531-232019
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: mips-fuloong2e_defconfig (attached as .config)
compiler: mips64el-linux-gnuabi64-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All errors (new ones prefixed by >>):

>> ERROR: "nfs4_inode_make_writeable" [fs/nfs/nfs.ko] undefined!
>> ERROR: "nfs4_inode_return_delegation" [fs/nfs/nfs.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 17398 bytes --]

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

end of thread, other threads:[~2018-06-01 13:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29 15:48 [PATCH] NFSv4: Fix sillyrename to return the delegation when appropriate Trond Myklebust
2018-05-29 18:33 ` Anna Schumaker
2018-05-29 19:23   ` Trond Myklebust
2018-06-01  8:47 ` kbuild test robot
2018-06-01 13:00 ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.