On Tue, Feb 11, 2025 at 06:01:21PM +0000, Viacheslav Dubeyko wrote: > After some considerations, I believe we can follow such simple logic. > Correct me if I will be wrong here. The ceph_lookup() method's responsibility is > to "look up a single dir entry". It sounds for me that if we have positive > dentry, > then it doesn't make sense to call the ceph_lookup(). And if ceph_lookup() has > been > called for the positive dentry, then something wrong is happening. VFS never calls it that way; ceph itself might, if ceph_handle_notrace_create() is called with positive dentry. > But all this logic is not about negative dentry, it's about local check > before sending request to MDS server. So, I think we need to change the logic > in likewise way: > > if (<we can check locally>) { > <do check locally> > if (-ENOENT) > return NULL; > } else { > <send request to MDS server> > } > > Am I right here? :) Let me change the logic in this way and to test it. First of all, returning NULL does *not* mean "it's negative"; d_add(dentry, NULL) does that. What would "we can check locally" be? AFAICS, the checks in __ceph_dir_is_complete() and near it are doing just that... The really unpleasant question is whether ceph_handle_notrace_create() could end up feeding an already-positive dentry to direct call of ceph_lookup()...