From 1a96f40a1048bc4a259715d1c7ca75de25c383e2 Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Sun, 11 Sep 2016 13:09:23 +0000 Subject: [PATCH 1/4] Fixed a bug about could not copy file mode from org file --- src/s3fs.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 194acee..93d285c 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -1561,6 +1561,17 @@ static int s3fs_chmod(const char* path, mode_t mode) return -EIO; } StatCache::getStatCacheData()->DelStat(nowcache); + + // check opened file handle. + // + // If we have already opened file handle, should set mode to it. + // And new mode is set when the file handle is closed. + // + FdEntity* ent; + if(NULL != (ent = FdManager::get()->ExistOpen(path))){ + ent->SetMode(mode); // Set new mode to opened fd. + FdManager::get()->Close(ent); + } } S3FS_MALLOCTRIM(0); From f363c21ff5a2efd71767d992dbc08b0b738e9d9a Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Sun, 11 Sep 2016 13:28:40 +0000 Subject: [PATCH 2/4] Added comments in failure message for test_chown --- test/integration-test-main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration-test-main.sh b/test/integration-test-main.sh index 693d5fc..1e4e6ad 100755 --- a/test/integration-test-main.sh +++ b/test/integration-test-main.sh @@ -207,7 +207,7 @@ function test_chown { # if they're the same, we have a problem. if [ $(stat --format=%u:%g $TEST_TEXT_FILE) == $ORIGINAL_PERMISSIONS ] then - echo "Could not modify $TEST_TEXT_FILE ownership" + echo "Could not modify $TEST_TEXT_FILE ownership($ORIGINAL_PERMISSIONS to 1000:1000)" return 1 fi From 232befb52a2cbca476f04839e7287fde765cf385 Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Sun, 11 Sep 2016 13:37:53 +0000 Subject: [PATCH 3/4] Added small logic in test script for test_chown --- test/integration-test-main.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/integration-test-main.sh b/test/integration-test-main.sh index 1e4e6ad..f74e1e6 100755 --- a/test/integration-test-main.sh +++ b/test/integration-test-main.sh @@ -207,8 +207,12 @@ function test_chown { # if they're the same, we have a problem. if [ $(stat --format=%u:%g $TEST_TEXT_FILE) == $ORIGINAL_PERMISSIONS ] then - echo "Could not modify $TEST_TEXT_FILE ownership($ORIGINAL_PERMISSIONS to 1000:1000)" - return 1 + if [ $ORIGINAL_PERMISSIONS == "1000:1000" ] + echo "Could not be strict check because original file permission 1000:1000" + else + echo "Could not modify $TEST_TEXT_FILE ownership($ORIGINAL_PERMISSIONS to 1000:1000)" + return 1 + then fi # clean up From ec110bb0f3ca33f9499a76011ae000c0bffac162 Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Sun, 11 Sep 2016 13:41:50 +0000 Subject: [PATCH 4/4] Added small logic in test script for test_chown --- test/integration-test-main.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration-test-main.sh b/test/integration-test-main.sh index f74e1e6..b9618ea 100755 --- a/test/integration-test-main.sh +++ b/test/integration-test-main.sh @@ -208,11 +208,12 @@ function test_chown { if [ $(stat --format=%u:%g $TEST_TEXT_FILE) == $ORIGINAL_PERMISSIONS ] then if [ $ORIGINAL_PERMISSIONS == "1000:1000" ] + then echo "Could not be strict check because original file permission 1000:1000" else echo "Could not modify $TEST_TEXT_FILE ownership($ORIGINAL_PERMISSIONS to 1000:1000)" return 1 - then + fi fi # clean up