On Tue, 2020-09-15 at 15:33 +0000, Nagendra Tomar wrote: > From: Nagendra S Tomar <natomar@xxxxxxxxxxxxx> > > If NFS_INO_INVALID_DATA cache_validity flag is set, a subsequent call > to nfs_invalidate_mapping() does the following two things: > > 1. Clears mapping. > 2. Resets cookieverf to 0, if inode refers to a directory. > > If there are no mapped pages, we don't need #1, but we still need #2. I don't think this patch is correct. Firstly, we don't support servers that use non-persistent readdir cookies, so if the cookieverf changes on the server, then we're not going to behave correctly w.r.t. expected POSIX readdir() behaviour. Secondly, even if we did support non-persistent cookies, then the NFS spec says that we need to set the verifier to zero when we are caching no readdir cookies that need validation, and we are reading the entire directory back from scratch (i.e. we're also supplying a zero dir_cookie). So the right place to do this set/reset of the verifier is in the readdir code, which knows not only the state of our cache, but also know what we're sending as RPC call arguments. Cheers Trond -- Trond Myklebust Linux NFS client maintainer, Hammerspace trond.myklebust@xxxxxxxxxxxxxxx