From 6c416cdc6be7845ff78cc595e7f2bd8eb54b1e21 Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Thu, 24 Nov 2016 07:57:33 -0500 Subject: [PATCH] LU-8847 tests: llapi_fid_test uses incorrect parameters Several function calls in test12 were providing incorrect parameters. The value "0600" was provided, in an attempt to create a file with read/write access for the owner. However, the parameters actually represent the open flags, so the incorrect parameters were instead requesting (O_EXCL | O_NOCTTY). Since llapi_create_volatile_idx by default already uses (O_RDWR | O_CREAT) and a mask of (S_IRUSR | S_IWUSR), there are no further flags required. For llapi_open_by_fid, only the minimum O_RDONLY is required (the call should not attempt to create the file). Test-Parameters: trivial Signed-off-by: Steve Guminski Change-Id: I5a1c9a014ab19a1a6a1901e2a8a091d4d65548f6 Reviewed-on: https://review.whamcloud.com/23939 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/tests/llapi_fid_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lustre/tests/llapi_fid_test.c b/lustre/tests/llapi_fid_test.c index 574bf43..c0fe8c4 100644 --- a/lustre/tests/llapi_fid_test.c +++ b/lustre/tests/llapi_fid_test.c @@ -279,7 +279,7 @@ static void test12(void) rc = mkdir(mainpath, 0); ASSERTF(rc == 0, "mkdir failed for '%s': %s", mainpath, strerror(errno)); - fd = llapi_create_volatile_idx(mainpath, -1, 0600); + fd = llapi_create_volatile_idx(mainpath, -1, 0); ASSERTF(fd >= 0, "creat failed for '%s': %s", mainpath, strerror(errno)); @@ -288,7 +288,7 @@ static void test12(void) mainpath, strerror(-rc)); /* No many ways to test, except to open by fid. */ - fd2 = llapi_open_by_fid(mainpath, &fid, 0600); + fd2 = llapi_open_by_fid(mainpath, &fid, O_RDONLY); ASSERTF(fd2 >= 0, "llapi_open_by_fid for " DFID_NOBRACE ": %s", PFID(&fid), strerror(errno)); @@ -296,7 +296,7 @@ static void test12(void) /* Check the file can still be opened, since fd2 is not * closed. */ - fd3 = llapi_open_by_fid(mainpath, &fid, 0600); + fd3 = llapi_open_by_fid(mainpath, &fid, O_RDONLY); ASSERTF(fd3 >= 0, "llapi_open_by_fid for " DFID_NOBRACE ": %s", PFID(&fid), strerror(errno)); @@ -304,7 +304,7 @@ static void test12(void) close(fd3); /* The volatile file is gone now. */ - fd = llapi_open_by_fid(mainpath, &fid, 0600); + fd = llapi_open_by_fid(mainpath, &fid, O_RDONLY); ASSERTF(fd < 0, "llapi_open_by_fid for " DFID_NOBRACE ": %d", PFID(&fid), fd); } -- 1.8.3.1