Whamcloud - gitweb
LU-5817 clio: Do not allow group locks with gid 0
[fs/lustre-release.git] / lustre / utils / lfs.c
index fa23bf1..47860f7 100644 (file)
@@ -368,6 +368,7 @@ static int random_group_id(int *gid)
                goto out;
        }
 
+retry:
        rc = read(fd, gid, sz);
        if (rc < sz) {
                rc = -errno;
@@ -376,6 +377,10 @@ static int random_group_id(int *gid)
                goto out;
        }
 
+       /* gids must be non-zero */
+       if (*gid == 0)
+               goto retry;
+
 out:
        if (fd >= 0)
                close(fd);