Re: How does GD_SYNCOP work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Emmanuel Dreyfus <manu@xxxxxxxxxx> wrote:

> I tracked down most of the problem. The request to glustershd times out
> before the reply comes, because glustershd gets stuck in an infinite loop.
> 
> In afr_shd_gather_index_entries(), the obtained offset is corrupted
> (huge negative value), and the loop never ens.

Here is the problem: once readdir() has reached the end of the
directory, on Linux, telldir() will report the last entry's offset,
while on NetBSD, it will report an invalid offset (it is in fact the
offset of the next entry beyond the last one, which does not exist).

The patch below breaks the infinite loop and lets NetBSD pass
tests/basic/self-heald.t, but I am not sure it is correct in the general
case. I suspect it breaks if  index_fill_readdir() is called multiple
time, which may happen for a large directory. I think the exit condition
should be handled better but I have to find how. Input appreciated.

diff --git a/xlators/features/index/src/index.c
b/xlators/features/index/src/index.c
index 2b80e71..1150380 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -284,6 +284,13 @@ index_fill_readdir (fd_t *fd, DIR *dir, off_t off,
         if (!off) {
                 rewinddir (dir);
         } else {
+#ifdef __NetBSD__
+               if (off > telldir(dir)) {
+                       errno = ENOENT;
+                       count = 0;
+                       goto out;
+               }
+#endif
                 seekdir (dir, off);
         }

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@xxxxxxxxxx
_______________________________________________
Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
http://supercolony.gluster.org/mailman/listinfo/gluster-devel




[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux