Message ID | 20180920151214.15484-7-mszeredi@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mount-api: fixes and cleanups | expand |
Miklos Szeredi <mszeredi@redhat.com> wrote: > The old name strongly implies that a new superblock will be created from > the fs_context. This is not true: filesystems are free to retuse an > existing superblock and return that (for good reason). Kind of like open(O_CREAT) only ever creates files, right;-) Actually, FSCONFIG_CMD_OPEN might be a better name. David
On Fri, Sep 21, 2018 at 5:11 PM, David Howells <dhowells@redhat.com> wrote: > Miklos Szeredi <mszeredi@redhat.com> wrote: > >> The old name strongly implies that a new superblock will be created from >> the fs_context. This is not true: filesystems are free to retuse an >> existing superblock and return that (for good reason). > > Kind of like open(O_CREAT) only ever creates files, right;-) > > Actually, FSCONFIG_CMD_OPEN might be a better name. We've already opened the context with fsopen() and about to open a file referring to a subtree with fsmount(). And this one doesn't actually involve opening any files, so IMO it should not be called _OPEN. Thanks, Miklos
diff --git a/fs/fsopen.c b/fs/fsopen.c index 9ead9220e2cb..bf1ff70b1fe2 100644 --- a/fs/fsopen.c +++ b/fs/fsopen.c @@ -311,7 +311,7 @@ static int vfs_fsconfig_action(struct fs_context *fc, enum fsconfig_command cmd) int ret = -EINVAL; switch (cmd) { - case FSCONFIG_CMD_CREATE: + case FSCONFIG_CMD_OBTAIN: if (fc->phase != FS_CONTEXT_CREATE_PARAMS) return -EBUSY; fc->phase = FS_CONTEXT_CREATING; @@ -434,7 +434,7 @@ SYSCALL_DEFINE5(fsconfig, if (!_key || _value || aux < 0) return -EINVAL; break; - case FSCONFIG_CMD_CREATE: + case FSCONFIG_CMD_OBTAIN: case FSCONFIG_CMD_RECONFIGURE: if (_key || _value || aux) return -EINVAL; @@ -523,7 +523,7 @@ SYSCALL_DEFINE5(fsconfig, ret = mutex_lock_interruptible(&fc->uapi_mutex); if (ret == 0) { switch (cmd) { - case FSCONFIG_CMD_CREATE: + case FSCONFIG_CMD_OBTAIN: case FSCONFIG_CMD_RECONFIGURE: ret = vfs_fsconfig_action(fc, cmd); break; diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 7f01503a9e9b..169642bb2656 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -366,7 +366,7 @@ enum fsconfig_command { FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ - FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ + FSCONFIG_CMD_OBTAIN = 6, /* Obtain new or existing superblock */ FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ }; diff --git a/samples/vfs/test-fsmount.c b/samples/vfs/test-fsmount.c index 74124025ade0..a161dc530a91 100644 --- a/samples/vfs/test-fsmount.c +++ b/samples/vfs/test-fsmount.c @@ -101,7 +101,7 @@ int main(int argc, char *argv[]) } E_fsconfig(fsfd, FSCONFIG_SET_STRING, "source", "#grand.central.org:root.cell.", 0); - E_fsconfig(fsfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0); + E_fsconfig(fsfd, FSCONFIG_CMD_OBTAIN, NULL, NULL, 0); mfd = fsmount(fsfd, 0, MS_RDONLY); if (mfd < 0)
The old name strongly implies that a new superblock will be created from the fs_context. This is not true: filesystems are free to retuse an existing superblock and return that (for good reason). To avoid confusion, rename this command to something more appropriate. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> --- fs/fsopen.c | 6 +++--- include/uapi/linux/fs.h | 2 +- samples/vfs/test-fsmount.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)