diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2014-10-02 02:14:07 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-10-03 02:05:48 -0700 |
commit | baa6f0ad759af024e4731a0f3889fe857ae2f1bf (patch) | |
tree | 0e38bc2c2ee77fa6261e54d236e1d7c596629563 /xlators/mgmt/glusterd/src/glusterd-quota.c | |
parent | a97ad9b69bb17f2351c59512fa9c6cb25d82b4da (diff) |
POSIX filesystem compliance: PATH_MAX
POSIX mandates the filesystem to support paths of lengths up to
_XOPEN_PATH_MAX (1024). This is the PATH_MAX limit here:
http://pubs.opengroup.org/onlinepubs/009604499/basedefs/limits.h.html
When using a path of 1023 bytes, the posix xlator attempts to create
an absolute path by prefixing the 1023 bytes path by the brick
base path. The result is an absolute path of more than _XOPEN_PATH_MAX
bytes which may be rejected by the backend filesystem.
Linux's ext3fs PATH_MAX seems to defaut to 4096, which means it
will work (except if brick base path is longer than 2072 bytes but
it is unlikely to happen. NetBSD's FFS PATH_MAX defaults to 1024,
which means the bug can happen regardless of brick base path length.
If this condition is detected for a brick, the proposed fix is to
chdir() the brick glusterfsd daemon to its brick base directory.
Then when encountering a path that will exceed _XOPEN_PATH_MAX once
prefixed by the brick base path, a relative path is used instead
of an absolute one. We do not always use relative path because some
operations require an absolute path on the brick base path itself
(e.g.: statvfs).
At least on NetBSD, this chdir() uncovers a race condition which
causes file lookup to fail with ENODATA for a few seconds. The
volume quickly reaches a sane state, but regression tests are fast
enough to choke on it. The reason is obscure (as often with race
conditions), but sleeping one second after the chdir() seems to
change scheduling enough that the problem disapear.
Note that since the chdir() is done if brick backend filesystem
does not support path long enough, it will not occur with Linux
ext3fs (except if brick base path is over 2072 bytes long).
BUG: 1129939
Change-Id: I7db3567948bc8fa8d99ca5f5ba6647fe425186a9
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8596
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-quota.c')
0 files changed, 0 insertions, 0 deletions