mirror of
https://github.com/libfuse/libfuse.git
synced 2024-11-23 04:04:31 +08:00
example/passthrough_hp: Fix . and .. readdir lookup count
Commit 170edc6a8e
added dot and dotdot (. and ..) to readdir
results, but introduced an issue when max number of entries
was reached - lookup count must not be decreased without
doing the lookup.
With ext4 as underlying file system readir seems to return . and ..
at random offsets and randomly failed xfstests for me.
This also fixes indentation, as passthrough_hp.cc does not follow
the linux indentation style (if we decide to fix this, it needs
to be done for the entire file).
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
This commit is contained in:
parent
fafe4069d0
commit
a83041fa1f
@ -735,6 +735,7 @@ static void do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||
}
|
||||
|
||||
while (1) {
|
||||
bool did_lookup = false;
|
||||
struct dirent *entry;
|
||||
errno = 0;
|
||||
entry = readdir(d->dp);
|
||||
@ -761,6 +762,7 @@ static void do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||
err = do_lookup(ino, entry->d_name, &e);
|
||||
if (err)
|
||||
goto error;
|
||||
did_lookup = true;
|
||||
}
|
||||
entsize = fuse_add_direntry_plus(req, p, rem, entry->d_name, &e, entry->d_off);
|
||||
} else {
|
||||
@ -772,7 +774,7 @@ static void do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||
if (entsize > rem) {
|
||||
if (fs.debug)
|
||||
cerr << "DEBUG: readdir(): buffer full, returning data. " << endl;
|
||||
if (plus)
|
||||
if (did_lookup)
|
||||
forget_one(e.ino, 1);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user