Commit 340a9772 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] autofs4: add ioctl to query unmountability

From: Ian Kent <raven@themaw.net>

Add ioctl to find out if autofs mount can be umounted.  When the daemon
discovers this it's past the point of no return.
parent f69b6618
...@@ -673,6 +673,23 @@ static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi, int *p) ...@@ -673,6 +673,23 @@ static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi, int *p)
return put_user(sbi->sub_version, p); return put_user(sbi->sub_version, p);
} }
/*
* Tells the daemon whether it can umount the autofs mount.
*/
static inline int autofs4_ask_umount(struct vfsmount *mnt, int *p)
{
int status = 0;
if (may_umount(mnt) == 0)
status = 1;
DPRINTK(("autofs_ask_umount: returning %d\n", status));
status = put_user(status, p);
return status;
}
/* Identify autofs4_dentries - this is so we can tell if there's /* Identify autofs4_dentries - this is so we can tell if there's
an extra dentry refcount or not. We only hold a refcount on the an extra dentry refcount or not. We only hold a refcount on the
dentry if its non-negative (ie, d_inode != NULL) dentry if its non-negative (ie, d_inode != NULL)
...@@ -719,6 +736,9 @@ static int autofs4_root_ioctl(struct inode *inode, struct file *filp, ...@@ -719,6 +736,9 @@ static int autofs4_root_ioctl(struct inode *inode, struct file *filp,
case AUTOFS_IOC_SETTIMEOUT: case AUTOFS_IOC_SETTIMEOUT:
return autofs4_get_set_timeout(sbi,(unsigned long *)arg); return autofs4_get_set_timeout(sbi,(unsigned long *)arg);
case AUTOFS_IOC_ASKUMOUNT:
return autofs4_ask_umount(filp->f_vfsmnt, (int *) arg);
/* return a single thing to expire */ /* return a single thing to expire */
case AUTOFS_IOC_EXPIRE: case AUTOFS_IOC_EXPIRE:
return autofs4_expire_run(inode->i_sb,filp->f_vfsmnt,sbi, return autofs4_expire_run(inode->i_sb,filp->f_vfsmnt,sbi,
......
...@@ -49,6 +49,7 @@ union autofs_packet_union { ...@@ -49,6 +49,7 @@ union autofs_packet_union {
#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int) #define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int)
#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) #define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int)
#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int)
#endif /* _LINUX_AUTO_FS4_H */ #endif /* _LINUX_AUTO_FS4_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment