autofs: remove wrong comment
Subsystems (3)
Ian Kent
maintainerPATCH 1/7 autofs: remove wrong comment
From: Tomohiro Kusumi <[email protected]>
This format seems to have been taken from device mapper header, but autofs has no such file:function in both kernel and userspace.
--- include/uapi/linux/auto_dev-ioctl.h | 4 ---- 1 file changed, 4 deletions(-)
include/uapi/linux/auto_dev-ioctl.h +0 -4
@@ -120,10 +120,6 @@ static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in) in->ioctlfd =-1 ; } -/* -* If you change this make sure you make the corresponding change -* to autofs-dev-ioctl.c:lookup_ioctl() -*/ enum {/* Get various version info */ AUTOFS_DEV_IOCTL_VERSION_CMD =0x71 ,
Ian Kent
maintainerPATCH 2/7 autofs: fix typo in Documentation
From: Tomohiro Kusumi <[email protected]>
--- Documentation/filesystems/autofs4.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/filesystems/autofs4.txt +3 -3
@@ -65,7 +65,7 @@ directory is a mount trap only if the filesystem is mounted *direct* and the root is empty. Directories created in the root directory are mount traps only if the -filesystem is mounted *indirect* and they are empty. +filesystem is mounted *indirect* and they are empty. Directories further down the tree depend on the *maxproto* mount option and particularly whether it is less than five or not.
@@ -352,7 +352,7 @@ Communicating with autofs: root directory ioctls ------------------------------------------------ The root directory of an autofs filesystem will respond to a number of -ioctls. The process issuing the ioctl must have the CAP_SYS_ADMIN +ioctls. The process issuing the ioctl must have the CAP_SYS_ADMIN capability, or must be the automount daemon. The available ioctl commands are:
@@ -512,7 +512,7 @@ always be mounted "shared". e.g. > `mount --make-shared /autofs/mount/point` -The automount daemon is only able to mange a single mount location for +The automount daemon is only able to manage a single mount location for an autofs filesystem and if mounts on that are not 'shared', other locations will not behave as expected. In particular access to those other locations will likely result in the `ELOOP` error
Ian Kent
maintainerPATCH 3/7 autofs: fix wrong ioctl documentation regarding devid
In reply to Ian KentFrom: Tomohiro Kusumi <[email protected]>
This is the same as d8732841 except that it's a different file. A caller has no devid input, and devid is obtained via superblock.
--- Documentation/filesystems/autofs4.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Documentation/filesystems/autofs4.txt +2 -3
@@ -457,9 +457,8 @@ Commands are: daemon. - **AUTOFS_DEV_IOCTL_REQUESTER_CMD**: `path` should be a name within the filesystem that has been auto-mounted on. - arg1 is the dev number of the underlying autofs. On successful - return, `arg1` and `arg2` will be the UID and GID of the process - which triggered that mount. + On successful return, `arg1` and `arg2` will be the UID and GID + of the process which triggered that mount. - **AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD**: Check if path is a mountpoint of a particular type - see separate documentation for
Ian Kent
maintainerPATCH 4/7 autofs: update ioctl documentation regarding struct autofs_dev_ioctl
In reply to Ian KentFrom: Tomohiro Kusumi <[email protected]>
This is the same as bf72eda5 except that it's a different file. Sync documentation with changes made by 730c9eec in 2009.
--- .../filesystems/autofs4-mount-control.txt | 1 + Documentation/filesystems/autofs4.txt | 32 +++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-)
Documentation/filesystems/autofs4-mount-control.txt +1 -0
@@ -179,6 +179,7 @@ struct autofs_dev_ioctl { * including this struct */ __s32 ioctlfd; /* automount command fd */ + /* Command parameters */ union { struct args_protover protover; struct args_protosubver protosubver;
Documentation/filesystems/autofs4.txt +21 -11
@@ -425,8 +425,20 @@ Each ioctl is passed a pointer to an `autofs_dev_ioctl` structure: * including this struct */ __s32 ioctlfd; /* automount command fd */ - __u32 arg1; /* Command parameters */ - __u32 arg2; + /* Command parameters */ + union { + struct args_protover protover; + struct args_protosubver protosubver; + struct args_openmount openmount; + struct args_ready ready; + struct args_fail fail; + struct args_setpipefd setpipefd; + struct args_timeout timeout; + struct args_requester requester; + struct args_expire expire; + struct args_askumount askumount; + struct args_ismountpoint ismountpoint; + }; char path[0]; };
@@ -446,24 +458,22 @@ Commands are: set version numbers. - **AUTOFS_DEV_IOCTL_OPENMOUNT_CMD**: return an open file descriptor on the root of an autofs filesystem. The filesystem is identified - by name and device number, which is stored in `arg1`. Device - numbers for existing filesystems can be found in + by name and device number, which is stored in `openmount.devid`. + Device numbers for existing filesystems can be found in `/proc/self/mountinfo`. - **AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD**: same as `close(ioctlfd)`. - **AUTOFS_DEV_IOCTL_SETPIPEFD_CMD**: if the filesystem is in catatonic mode, this can provide the write end of a new pipe - in `arg1` to re-establish communication with a daemon. The - process group of the calling process is used to identify the + in `setpipefd.pipefd` to re-establish communication with a daemon. + The process group of the calling process is used to identify the daemon. - **AUTOFS_DEV_IOCTL_REQUESTER_CMD**: `path` should be a name within the filesystem that has been auto-mounted on. - On successful return, `arg1` and `arg2` will be the UID and GID - of the process which triggered that mount. - + On successful return, `requester.uid` and `requester.gid` will be + the UID and GID of the process which triggered that mount. - **AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD**: Check if path is a mountpoint of a particular type - see separate documentation for details. - - **AUTOFS_DEV_IOCTL_PROTOVER_CMD**: - **AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD**: - **AUTOFS_DEV_IOCTL_READY_CMD**:
@@ -473,7 +483,7 @@ Commands are: - **AUTOFS_DEV_IOCTL_EXPIRE_CMD**: - **AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD**: These all have the same function as the similarly named **AUTOFS_IOC** ioctls, except - that **FAIL** can be given an explicit error number in `arg1` + that **FAIL** can be given an explicit error number in `fail.status` instead of assuming `ENOENT`, and this **EXPIRE** command corresponds to **AUTOFS_IOC_EXPIRE_MULTI**.
Ian Kent
maintainerPATCH 5/7 autofs: add command enum/macros for root-dir ioctls
In reply to Ian KentFrom: Tomohiro Kusumi <[email protected]>
Sync root-dir ioctl with misc-char-dev ioctl's enum/macro format since these two types of ioctls aren't completely independent of each other in terms of command nr. No functional changes.
--- include/uapi/linux/auto_dev-ioctl.h | 2 -- include/uapi/linux/auto_fs.h | 25 ++++++++++++++++++------- include/uapi/linux/auto_fs4.h | 16 +++++++++++----- 3 files changed, 29 insertions(+), 14 deletions(-)
include/uapi/linux/auto_dev-ioctl.h +0 -2
@@ -156,8 +156,6 @@ enum { AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, }; -#define AUTOFS_IOCTL 0x93 -#define AUTOFS_DEV_IOCTL_VERSION \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)
include/uapi/linux/auto_fs.h +18 -7
@@ -61,12 +61,23 @@ struct autofs_packet_expire { char name[NAME_MAX+1]; }; -#define AUTOFS_IOC_READY _IO(0x93, 0x60) -#define AUTOFS_IOC_FAIL _IO(0x93, 0x61) -#define AUTOFS_IOC_CATATONIC _IO(0x93, 0x62) -#define AUTOFS_IOC_PROTOVER _IOR(0x93, 0x63, int) -#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93, 0x64, compat_ulong_t) -#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93, 0x64, unsigned long) -#define AUTOFS_IOC_EXPIRE _IOR(0x93, 0x65, struct autofs_packet_expire) +#define AUTOFS_IOCTL 0x93 + +enum { +AUTOFS_IOC_READY_CMD =0x60 , +AUTOFS_IOC_FAIL_CMD , +AUTOFS_IOC_CATATONIC_CMD , +AUTOFS_IOC_PROTOVER_CMD , +AUTOFS_IOC_SETTIMEOUT_CMD , +AUTOFS_IOC_EXPIRE_CMD , +}; + +#define AUTOFS_IOC_READY _IO(AUTOFS_IOCTL, AUTOFS_IOC_READY_CMD) +#define AUTOFS_IOC_FAIL _IO(AUTOFS_IOCTL, AUTOFS_IOC_FAIL_CMD) +#define AUTOFS_IOC_CATATONIC _IO(AUTOFS_IOCTL, AUTOFS_IOC_CATATONIC_CMD) +#define AUTOFS_IOC_PROTOVER _IOR(AUTOFS_IOCTL, AUTOFS_IOC_PROTOVER_CMD, int) +#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(AUTOFS_IOCTL, AUTOFS_IOC_SETTIMEOUT_CMD, compat_ulong_t) +#define AUTOFS_IOC_SETTIMEOUT _IOWR(AUTOFS_IOCTL, AUTOFS_IOC_SETTIMEOUT_CMD, unsigned long) +#define AUTOFS_IOC_EXPIRE _IOR(AUTOFS_IOCTL, AUTOFS_IOC_EXPIRE_CMD, struct autofs_packet_expire)#endif /* _UAPI_LINUX_AUTO_FS_H */
include/uapi/linux/auto_fs4.h +11 -5
@@ -148,10 +148,16 @@ union autofs_v5_packet_union { autofs_packet_expire_direct_t expire_direct; }; -#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93, 0x66, int) -#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI -#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI -#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93, 0x67, int) -#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93, 0x70, int) +enum { +AUTOFS_IOC_EXPIRE_MULTI_CMD =0x66 ,/* AUTOFS_IOC_EXPIRE_CMD + 1 */ +AUTOFS_IOC_PROTOSUBVER_CMD , +AUTOFS_IOC_ASKUMOUNT_CMD =0x70 ,/* AUTOFS_DEV_IOCTL_VERSION_CMD - 1 */ +}; + +#define AUTOFS_IOC_EXPIRE_MULTI _IOW(AUTOFS_IOCTL, AUTOFS_IOC_EXPIRE_MULTI_CMD, int) +#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI +#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI +#define AUTOFS_IOC_PROTOSUBVER _IOR(AUTOFS_IOCTL, AUTOFS_IOC_PROTOSUBVER_CMD, int) +#define AUTOFS_IOC_ASKUMOUNT _IOR(AUTOFS_IOCTL, AUTOFS_IOC_ASKUMOUNT_CMD, int)#endif /* _LINUX_AUTO_FS4_H */
Ian Kent
maintainerPATCH 6/7 autofs: remove duplicated AUTOFS_DEV_IOCTL_SIZE definition
In reply to Ian KentFrom: Tomohiro Kusumi <[email protected]>
This macro is already defined in uapi header.
Also use this macro where possible.
--- fs/autofs4/dev-ioctl.c | 2 -- include/uapi/linux/auto_dev-ioctl.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)
fs/autofs4/dev-ioctl.c +0 -2
@@ -38,8 +38,6 @@* which have been left busy at at service shutdown. */ -#define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl) -typedef int (*ioctl_fn )(struct file *,struct autofs_sb_info *,struct autofs_dev_ioctl *);
include/uapi/linux/auto_dev-ioctl.h +2 -2
@@ -113,10 +113,10 @@ struct autofs_dev_ioctl {static inline void init_autofs_dev_ioctl (struct autofs_dev_ioctl *in) { -memset (in,0 ,sizeof (struct autofs_dev_ioctl )); +memset (in,0 ,AUTOFS_DEV_IOCTL_SIZE ); in->ver_major =AUTOFS_DEV_IOCTL_VERSION_MAJOR ; in->ver_minor =AUTOFS_DEV_IOCTL_VERSION_MINOR ; - in->size =sizeof (struct autofs_dev_ioctl ); + in->size =AUTOFS_DEV_IOCTL_SIZE ; in->ioctlfd =-1 ; }
--
To unsubscribe from this list: send the line "unsubscribe autofs" in
Ian Kent
maintainerPATCH 7/7 autofs - take more care to not update last_used on path walk
In reply to Ian KentGUI environments seem to be becoming more agressive at scanning filesystems, to the point where autofs cannot expire mounts at all.
This is one key reason the update of the autofs dentry info last_used field is done in the expire system when the dentry is seen to be in use.
But somewhere along the way instances of the update has crept back into the autofs path walk functions which, with the more aggressive file access patterns, is preventing expiration.
Changing the update in the path walk functions allows autofs to at least make progress in spite of frequent immediate re-mounts from file accesses.
--- fs/autofs4/root.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
fs/autofs4/root.c +11 -6
@@ -281,8 +281,8 @@ static int autofs4_mount_wait(struct dentry *dentry, bool rcu_walk)pr_debug ("waiting for mount name=%pd\n" , dentry); status =autofs4_wait (sbi, dentry,NFY_MOUNT );pr_debug ("mount wait done status=%d\n" , status); + ino->last_used = jiffies; } - ino->last_used = jiffies;return status; }
@@ -319,16 +319,21 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path)*/ if (autofs_type_indirect (sbi->type) &&d_unhashed (dentry)) {struct dentry *parent = dentry->d_parent; -struct autofs_info *ino;struct dentry *new; new =d_lookup (parent, &dentry->d_name);if (!new)return NULL ; - ino =autofs4_dentry_ino (new); - ino->last_used = jiffies; -dput (path->dentry); - path->dentry = new; +if (new == dentry) +dput (new); +else { +struct autofs_info *ino; + + ino =autofs4_dentry_ino (new); + ino->last_used = jiffies; +dput (path->dentry); + path->dentry = new; + } }return path->dentry; }