diff mbox

fscache: put reference of parent's usage and n_children

Message ID 5527C9A0.6030502@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee April 10, 2015, 1:01 p.m. UTC
If netfs exist, fscache must put the reference of parent's
usage and n_children, otherwise, never be decreased.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/fscache/netfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

David Howells April 13, 2015, 11:33 a.m. UTC | #1
Kinglong Mee <kinglongmee@gmail.com> wrote:

> If netfs exist, fscache must put the reference of parent's
> usage and n_children, otherwise, never be decreased.

Good catch.  Though it might be preferable to only increment the counters if
the list_add() is done.

David
--
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
Kinglong Mee April 13, 2015, 12:23 p.m. UTC | #2
On 4/13/2015 7:33 PM, David Howells wrote:
> Kinglong Mee <kinglongmee@gmail.com> wrote:
> 
>> If netfs exist, fscache must put the reference of parent's
>> usage and n_children, otherwise, never be decreased.
> 
> Good catch.  Though it might be preferable to only increment the counters if
> the list_add() is done.

Thanks for your comments, that's great.
I will update and resend those two patch.

Thanks,
Kinglong Mee
--
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
David Howells April 13, 2015, 12:44 p.m. UTC | #3
Kinglong Mee <kinglongmee@gmail.com> wrote:

> > Good catch.  Though it might be preferable to only increment the counters if
> > the list_add() is done.
> 
> Thanks for your comments, that's great.
> I will update and resend those two patch.

In fact, kmem_cache_free() can be called instead of
fscache_relinquish_cookie() in that case.

David
--
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
diff mbox

Patch

diff --git a/fs/fscache/netfs.c b/fs/fscache/netfs.c
index 6d941f5..b16afba 100644
--- a/fs/fscache/netfs.c
+++ b/fs/fscache/netfs.c
@@ -71,8 +71,7 @@  already_registered:
 	up_write(&fscache_addremove_sem);
 
 	if (ret < 0) {
-		netfs->primary_index->parent = NULL;
-		__fscache_cookie_put(netfs->primary_index);
+		fscache_relinquish_cookie(netfs->primary_index, 0);
 		netfs->primary_index = NULL;
 	}