[105/105] nfsd4: fix oops on lock failure
diff mbox

Message ID 20110418153236.GC20935@pad.home.fieldses.org
State New, archived
Headers show

Commit Message

J. Bruce Fields April 18, 2011, 3:32 p.m. UTC
On Sun, Apr 17, 2011 at 09:10:12AM -0700, Linus Torvalds wrote:
> On Sun, Apr 17, 2011 at 8:03 AM, OGAWA Hirofumi
> <hirofumi@mail.parknet.co.jp> wrote:
> >
> > I'm looking filp leak on recent kernel. Well, anyway,

Does this fix it?

--b.

commit 5152c8a947359758862d4631863e68e83ec01048
Author: J. Bruce Fields <bfields@redhat.com>
Date:   Fri Apr 15 18:08:26 2011 -0400

    nfsd4: fix struct file leak on delegation
    
    Introduced by acfdf5c383b38f7f4dddae41b97c97f1ae058f49.
    
    Cc: stable@kernel.org
    Reported-by: Gerhard Heift <ml-nfs-linux-20110412-ef47@gheift.de>
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>

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

Comments

J. Bruce Fields April 18, 2011, 3:42 p.m. UTC | #1
On Mon, Apr 18, 2011 at 11:32:36AM -0400, J. Bruce Fields wrote:
> On Sun, Apr 17, 2011 at 09:10:12AM -0700, Linus Torvalds wrote:
> > On Sun, Apr 17, 2011 at 8:03 AM, OGAWA Hirofumi
> > <hirofumi@mail.parknet.co.jp> wrote:
> > >
> > > I'm looking filp leak on recent kernel. Well, anyway,
> 
> Does this fix it?

(But, yes, I think your patch is almost certainly right as well.
Gah--I've been introducing depressing number of regressions lately.)

--b.

> 
> --b.
> 
> commit 5152c8a947359758862d4631863e68e83ec01048
> Author: J. Bruce Fields <bfields@redhat.com>
> Date:   Fri Apr 15 18:08:26 2011 -0400
> 
>     nfsd4: fix struct file leak on delegation
>     
>     Introduced by acfdf5c383b38f7f4dddae41b97c97f1ae058f49.
>     
>     Cc: stable@kernel.org
>     Reported-by: Gerhard Heift <ml-nfs-linux-20110412-ef47@gheift.de>
>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index aa309aa..c79a983 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -258,6 +258,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp)
>  	if (atomic_dec_and_test(&fp->fi_delegees)) {
>  		vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease);
>  		fp->fi_lease = NULL;
> +		fput(fp->fi_deleg_file);
>  		fp->fi_deleg_file = NULL;
>  	}
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
OGAWA Hirofumi April 18, 2011, 4:08 p.m. UTC | #2
"J. Bruce Fields" <bfields@redhat.com> writes:

> On Sun, Apr 17, 2011 at 09:10:12AM -0700, Linus Torvalds wrote:
>> On Sun, Apr 17, 2011 at 8:03 AM, OGAWA Hirofumi
>> <hirofumi@mail.parknet.co.jp> wrote:
>> >
>> > I'm looking filp leak on recent kernel. Well, anyway,
>
> Does this fix it?

It seems to be no, unfortunately. filp leak is not so fast, and obvious
reproduce process is not known yet. Well, sigh, I'm starting to add
debugging code for it...
OGAWA Hirofumi April 18, 2011, 4:10 p.m. UTC | #3
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

> "J. Bruce Fields" <bfields@redhat.com> writes:
>
>> On Sun, Apr 17, 2011 at 09:10:12AM -0700, Linus Torvalds wrote:
>>> On Sun, Apr 17, 2011 at 8:03 AM, OGAWA Hirofumi
>>> <hirofumi@mail.parknet.co.jp> wrote:
>>> >
>>> > I'm looking filp leak on recent kernel. Well, anyway,
>>
>> Does this fix it?
>
> It seems to be no, unfortunately. filp leak is not so fast, and obvious
> reproduce process is not known yet. Well, sigh, I'm starting to add
> debugging code for it...

Ah, I was missing patch itself. I'll see.

> commit 5152c8a947359758862d4631863e68e83ec01048
> Author: J. Bruce Fields <bfields@redhat.com>
> Date:   Fri Apr 15 18:08:26 2011 -0400
> 
>     nfsd4: fix struct file leak on delegation
>     
>     Introduced by acfdf5c383b38f7f4dddae41b97c97f1ae058f49.
>     
>     Cc: stable@kernel.org
>     Reported-by: Gerhard Heift <ml-nfs-linux-20110412-ef47@gheift.de>
>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index aa309aa..c79a983 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -258,6 +258,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp)
>  	if (atomic_dec_and_test(&fp->fi_delegees)) {
>  		vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease);
>  		fp->fi_lease = NULL;
> +		fput(fp->fi_deleg_file);
>  		fp->fi_deleg_file = NULL;
>  	}
>  }
OGAWA Hirofumi April 18, 2011, 4:39 p.m. UTC | #4
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

>> commit 5152c8a947359758862d4631863e68e83ec01048
>> Author: J. Bruce Fields <bfields@redhat.com>
>> Date:   Fri Apr 15 18:08:26 2011 -0400
>> 
>>     nfsd4: fix struct file leak on delegation
>>     
>>     Introduced by acfdf5c383b38f7f4dddae41b97c97f1ae058f49.
>>     
>>     Cc: stable@kernel.org
>>     Reported-by: Gerhard Heift <ml-nfs-linux-20110412-ef47@gheift.de>
>>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
>> 
>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>> index aa309aa..c79a983 100644
>> --- a/fs/nfsd/nfs4state.c
>> +++ b/fs/nfsd/nfs4state.c
>> @@ -258,6 +258,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp)
>>  	if (atomic_dec_and_test(&fp->fi_delegees)) {
>>  		vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease);
>>  		fp->fi_lease = NULL;
>> +		fput(fp->fi_deleg_file);
>>  		fp->fi_deleg_file = NULL;
>>  	}
>>  }

For now, I feel this explain filp leak on my system. the leak is
increased slowly (filp, cred_jar, and no nfs* slabs), and leak is on
nfs server side.

I'll start test of this patch, and see what happens.

Thanks.
Linus Torvalds April 18, 2011, 4:59 p.m. UTC | #5
On Mon, Apr 18, 2011 at 9:39 AM, OGAWA Hirofumi
<hirofumi@mail.parknet.co.jp> wrote:
>
> For now, I feel this explain filp leak on my system. the leak is
> increased slowly (filp, cred_jar, and no nfs* slabs), and leak is on
> nfs server side.
>
> I'll start test of this patch, and see what happens.

Can somebody ping/remind me when that is verified - preferably about
_both_ patches, even if it turns out that the first one by Ogawa
wasn't the one that caused the problem?

Or can I just assume that the fix will be in Bruce's pull requests some day?

                         Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
J. Bruce Fields April 18, 2011, 5:16 p.m. UTC | #6
On Mon, Apr 18, 2011 at 09:59:26AM -0700, Linus Torvalds wrote:
> On Mon, Apr 18, 2011 at 9:39 AM, OGAWA Hirofumi
> <hirofumi@mail.parknet.co.jp> wrote:
> >
> > For now, I feel this explain filp leak on my system. the leak is
> > increased slowly (filp, cred_jar, and no nfs* slabs), and leak is on
> > nfs server side.
> >
> > I'll start test of this patch, and see what happens.
> 
> Can somebody ping/remind me when that is verified - preferably about
> _both_ patches, even if it turns out that the first one by Ogawa
> wasn't the one that caused the problem?
> 
> Or can I just assume that the fix will be in Bruce's pull requests some day?

I'll send a pull request when it's sorted out, thanks.

--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg KH April 18, 2011, 6:21 p.m. UTC | #7
On Mon, Apr 18, 2011 at 01:16:43PM -0400, J. Bruce Fields wrote:
> On Mon, Apr 18, 2011 at 09:59:26AM -0700, Linus Torvalds wrote:
> > On Mon, Apr 18, 2011 at 9:39 AM, OGAWA Hirofumi
> > <hirofumi@mail.parknet.co.jp> wrote:
> > >
> > > For now, I feel this explain filp leak on my system. the leak is
> > > increased slowly (filp, cred_jar, and no nfs* slabs), and leak is on
> > > nfs server side.
> > >
> > > I'll start test of this patch, and see what happens.
> > 
> > Can somebody ping/remind me when that is verified - preferably about
> > _both_ patches, even if it turns out that the first one by Ogawa
> > wasn't the one that caused the problem?
> > 
> > Or can I just assume that the fix will be in Bruce's pull requests some day?
> 
> I'll send a pull request when it's sorted out, thanks.

Please tag it for stable as well so I know to pick it up.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
OGAWA Hirofumi April 18, 2011, 9:12 p.m. UTC | #8
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:
>
>>> commit 5152c8a947359758862d4631863e68e83ec01048
>>> Author: J. Bruce Fields <bfields@redhat.com>
>>> Date:   Fri Apr 15 18:08:26 2011 -0400
>>> 
>>>     nfsd4: fix struct file leak on delegation
>>>     
>>>     Introduced by acfdf5c383b38f7f4dddae41b97c97f1ae058f49.
>>>     
>>>     Cc: stable@kernel.org
>>>     Reported-by: Gerhard Heift <ml-nfs-linux-20110412-ef47@gheift.de>
>>>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
>>> 
>>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>>> index aa309aa..c79a983 100644
>>> --- a/fs/nfsd/nfs4state.c
>>> +++ b/fs/nfsd/nfs4state.c
>>> @@ -258,6 +258,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp)
>>>  	if (atomic_dec_and_test(&fp->fi_delegees)) {
>>>  		vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease);
>>>  		fp->fi_lease = NULL;
>>> +		fput(fp->fi_deleg_file);
>>>  		fp->fi_deleg_file = NULL;
>>>  	}
>>>  }
>
> For now, I feel this explain filp leak on my system. the leak is
> increased slowly (filp, cred_jar, and no nfs* slabs), and leak is on
> nfs server side.
>
> I'll start test of this patch, and see what happens.

OK. Although filp slabs are still slightly increasing (I'm not sure yet
whether this is leak of filp on system). But watching before/after
patch, the graph of filp slabs is clearly different.

As far as I can say patches are fine.

Thanks.
OGAWA Hirofumi April 19, 2011, 8:21 a.m. UTC | #9
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

>> I'll start test of this patch, and see what happens.
>
> OK. Although filp slabs are still slightly increasing (I'm not sure yet
> whether this is leak of filp on system). But watching before/after
> patch, the graph of filp slabs is clearly different.
>
> As far as I can say patches are fine.

slightly increasing was stopped at 2200-2300. filp leak seems to be fixed.

Thanks.
J. Bruce Fields April 19, 2011, 8:43 p.m. UTC | #10
On Tue, Apr 19, 2011 at 05:21:57PM +0900, OGAWA Hirofumi wrote:
> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:
> 
> >> I'll start test of this patch, and see what happens.
> >
> > OK. Although filp slabs are still slightly increasing (I'm not sure yet
> > whether this is leak of filp on system). But watching before/after
> > patch, the graph of filp slabs is clearly different.
> >
> > As far as I can say patches are fine.
> 
> slightly increasing was stopped at 2200-2300. filp leak seems to be fixed.

Another thing to check is whether you can always unmount the exported
filesystem on the server after running your test.  So something like:

	service nfs stop
	unmount /exports/fs

should always succeed; if you get an inexplicable EBUSY on the final
unmount then we likely still have a leak someplace.

--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
OGAWA Hirofumi April 19, 2011, 9:17 p.m. UTC | #11
"J. Bruce Fields" <bfields@fieldses.org> writes:

> On Tue, Apr 19, 2011 at 05:21:57PM +0900, OGAWA Hirofumi wrote:
>> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:
>> 
>> >> I'll start test of this patch, and see what happens.
>> >
>> > OK. Although filp slabs are still slightly increasing (I'm not sure yet
>> > whether this is leak of filp on system). But watching before/after
>> > patch, the graph of filp slabs is clearly different.
>> >
>> > As far as I can say patches are fine.
>> 
>> slightly increasing was stopped at 2200-2300. filp leak seems to be fixed.
>
> Another thing to check is whether you can always unmount the exported
> filesystem on the server after running your test.  So something like:
>
> 	service nfs stop
> 	unmount /exports/fs
>
> should always succeed; if you get an inexplicable EBUSY on the final
> unmount then we likely still have a leak someplace.

It succeeded.
J. Bruce Fields April 19, 2011, 9:33 p.m. UTC | #12
On Wed, Apr 20, 2011 at 06:17:03AM +0900, OGAWA Hirofumi wrote:
> "J. Bruce Fields" <bfields@fieldses.org> writes:
> 
> > On Tue, Apr 19, 2011 at 05:21:57PM +0900, OGAWA Hirofumi wrote:
> >> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:
> >> 
> >> >> I'll start test of this patch, and see what happens.
> >> >
> >> > OK. Although filp slabs are still slightly increasing (I'm not sure yet
> >> > whether this is leak of filp on system). But watching before/after
> >> > patch, the graph of filp slabs is clearly different.
> >> >
> >> > As far as I can say patches are fine.
> >> 
> >> slightly increasing was stopped at 2200-2300. filp leak seems to be fixed.
> >
> > Another thing to check is whether you can always unmount the exported
> > filesystem on the server after running your test.  So something like:
> >
> > 	service nfs stop
> > 	unmount /exports/fs
> >
> > should always succeed; if you get an inexplicable EBUSY on the final
> > unmount then we likely still have a leak someplace.
> 
> It succeeded.

Good, thanks.--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
J. Bruce Fields April 20, 2011, 11:23 p.m. UTC | #13
Bugfixes for nfsd are available from the for-2.6.39 branch at:

  git://linux-nfs.org/~bfields/linux.git for-2.6.39

In particular, this should deal with the file leaks noticed by several
people.

--b.

J. Bruce Fields (1):
      nfsd4: fix struct file leak on delegation

OGAWA Hirofumi (1):
      nfsd4: Fix filp leak

Sachin Prabhu (1):
      Open with O_CREAT flag set fails to open existing files on non writable directories

 fs/nfsd/nfs4state.c |    3 ++-
 fs/nfsd/vfs.c       |    9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index aa309aa..c79a983 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -258,6 +258,7 @@  static void nfs4_put_deleg_lease(struct nfs4_file *fp)
 	if (atomic_dec_and_test(&fp->fi_delegees)) {
 		vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease);
 		fp->fi_lease = NULL;
+		fput(fp->fi_deleg_file);
 		fp->fi_deleg_file = NULL;
 	}
 }