Whamcloud - gitweb
LU-7057 utils: use stronger flags when opening volatile files 66/16166/5
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 1 Sep 2015 21:50:44 +0000 (16:50 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 14 Sep 2015 15:57:44 +0000 (15:57 +0000)
commit63b37d321fbe27d72055e3895ad94305d56927d7
treec60ffe64d94eac4cd19a1b7135ad4d52ded7b9f7
parent61b4d4ff8e9a6e7539aa3a7dcc4dd1aea6b4f927
LU-7057 utils: use stronger flags when opening volatile files

Existing files with volatile-ish names may be accidentally opened by
lfs_migrate(). This is not the intent so disallow this behavior by
adding O_EXCL and O_NOFOLLOW to the flags to open(). Use the original
file's MDT index and a random suffix when constructing the volatile
file name (as is done in llapi_create_volatile_idx()) and reduce the
mode of the file created.

To handle pre-existing files use a do while lookup around the volatile
opens in llapi_create_volatile_idx() and lfs_migrate().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I399d30104d841df13fe1051aaa8264514911714d
Reviewed-on: http://review.whamcloud.com/16166
Tested-by: Jenkins
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/utils/lfs.c
lustre/utils/liblustreapi.c