Got it. Thanks Frank.

On Mon, Mar 1, 2021 at 1:25 PM Frank Filz <ffilzlnx@mindspring.com> wrote:

Yea, if a single Ganesha process is the only process accessing the directory, then mdcache_dirent_add would keep additions current. Note however, that unless you are using a FSAL that can place new dirents into chunks because the FSAL can compute the entry cookie, the chunk cache will be invalidated by any additions to the directory.

 

Frank

 

From: Pradeep [mailto:pradeepthomas@gmail.com]
Sent: Monday, March 1, 2021 8:53 AM
To: Frank Filz <ffilzlnx@mindspring.com>
Cc: Daniel Gryniewicz <dang@redhat.com>; Ganesha-devel <devel@lists.nfs-ganesha.org>
Subject: [NFS-Ganesha-Devel] Re: unlink of one dirent could invalidate all.

 

Thanks Frank. If Ganesha is the only server, do you think additions can be missed - I see that we do mdcache_dirent_add() from mdcache_alloc_and_check_handle(). Wouldn't that be good enough to cover additions or are there cases we might miss it? place_new_dirent() also invalidates if it can't place new dirent.

 

Thanks,

Pradeep

 

On Mon, Mar 1, 2021 at 8:02 AM Frank Filz <ffilzlnx@mindspring.com> wrote:

The danger in not invalidating is that something that adds an entry races with the deletion such that we miss the addition. Or even a deletion external to Ganesha.

 

Frank

 

From: Pradeep [mailto:pradeepthomas@gmail.com]
Sent: Sunday, February 28, 2021 11:19 PM
To: Frank Filz <ffilzlnx@mindspring.com>; Daniel Gryniewicz <dang@redhat.com>; Ganesha-devel <devel@lists.nfs-ganesha.org>
Subject: [NFS-Ganesha-Devel] unlink of one dirent could invalidate all.

 

Hello,

 

In mdcache_unlink, ganesha removes the dirent from its parent by calling mdcache_dirent_remove(). It also clears MDCACHE_TRUST_ATTRS. So, if a subsequent GETATTR comes for the parent (which can happen in the same compound from nfs4_op_remove), it frees all entries at the end of mdcache_refresh_attrs(). In this scenario, isn't it possible to keep the rest of dirents intact?

 

I'm thinking if we update parents attrs in unlink itself, would it prevent any further refreshes? The use case here is large directories with frequent additions/deletions/enumerations.

 

Thanks,

Pradeep