diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2014-10-14 12:11:24 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-10-29 02:26:32 -0700 |
commit | 22e18a4c0c07a41fcdcde1ce0e90961b347d7a84 (patch) | |
tree | 5f75a0870aa1f76e4c440be47c6b5a94fc1f54f1 /xlators/storage/posix/src/posix.h | |
parent | 5ae0df29b4e590d9a8a5f3c8f9e98cc944b006cf (diff) |
Avoid spurious EINVAL in posix_readdir()
On non Linux systems, we check that seekdir() succeeds and we return
EINVAL if it does not. We need this to avoid infinite loops if some
other component in GlusterFS makes an invalid seekdir() usage. This
was introduced in this change: http://review.gluster.org/#/c/8760/
But seekdir() also fails when using the offset returned for the
last entry, and this is expected behavior. As a result, the seekdir()
test produces a spurious EINVAL when reaching end of directory. That
error is not propagated to calling process, but it may harm internal
GlusterFS processing. At least it produce a spurious error message
in brick's log.
We fix the problem by remembering the last entry offset in fd private
data. When a new posix_readdir() invocation requests that offset,
we avoid returning EINVAL.
BUG: 1129939
Change-Id: I4e67a2ea46538aae63eea663dd4aa33b16ad24c7
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8926
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix.h')
-rw-r--r-- | xlators/storage/posix/src/posix.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h index 5bb5e873c82..870315d0ea2 100644 --- a/xlators/storage/posix/src/posix.h +++ b/xlators/storage/posix/src/posix.h @@ -68,6 +68,7 @@ struct posix_fd { int fd; /* fd returned by the kernel */ int32_t flags; /* flags for open/creat */ DIR * dir; /* handle returned by the kernel */ + off_t dir_eof; /* offset at dir EOF */ int odirect; struct list_head list; /* to add to the janitor list */ }; |