David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 1 | /* mountpoint management |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
| 3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/kernel.h> |
| 13 | #include <linux/module.h> |
| 14 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <linux/fs.h> |
| 16 | #include <linux/pagemap.h> |
| 17 | #include <linux/mount.h> |
| 18 | #include <linux/namei.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 19 | #include <linux/gfp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include "internal.h" |
| 21 | |
| 22 | |
| 23 | static struct dentry *afs_mntpt_lookup(struct inode *dir, |
| 24 | struct dentry *dentry, |
| 25 | struct nameidata *nd); |
| 26 | static int afs_mntpt_open(struct inode *inode, struct file *file); |
Al Viro | 008b150 | 2005-08-20 00:17:39 +0100 | [diff] [blame] | 27 | static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 28 | static void afs_mntpt_expiry_timed_out(struct work_struct *work); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Arjan van de Ven | 4b6f5d2 | 2006-03-28 01:56:42 -0800 | [diff] [blame] | 30 | const struct file_operations afs_mntpt_file_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | .open = afs_mntpt_open, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 32 | .llseek = noop_llseek, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | }; |
| 34 | |
Arjan van de Ven | 754661f | 2007-02-12 00:55:38 -0800 | [diff] [blame] | 35 | const struct inode_operations afs_mntpt_inode_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | .lookup = afs_mntpt_lookup, |
| 37 | .follow_link = afs_mntpt_follow_link, |
| 38 | .readlink = page_readlink, |
David Howells | 416351f | 2007-05-09 02:33:45 -0700 | [diff] [blame] | 39 | .getattr = afs_getattr, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
wanglei | bec5eb6 | 2010-08-11 09:38:04 +0100 | [diff] [blame] | 42 | const struct inode_operations afs_autocell_inode_operations = { |
| 43 | .follow_link = afs_mntpt_follow_link, |
| 44 | .getattr = afs_getattr, |
| 45 | }; |
| 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | static LIST_HEAD(afs_vfsmounts); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 48 | static DECLARE_DELAYED_WORK(afs_mntpt_expiry_timer, afs_mntpt_expiry_timed_out); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
Adrian Bunk | c1206a2 | 2007-10-16 23:26:41 -0700 | [diff] [blame] | 50 | static unsigned long afs_mntpt_expiry_timeout = 10 * 60; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | /* |
| 53 | * check a symbolic link to see whether it actually encodes a mountpoint |
| 54 | * - sets the AFS_VNODE_MOUNTPOINT flag on the vnode appropriately |
| 55 | */ |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 56 | int afs_mntpt_check_symlink(struct afs_vnode *vnode, struct key *key) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | { |
| 58 | struct page *page; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | size_t size; |
| 60 | char *buf; |
| 61 | int ret; |
| 62 | |
David Howells | 416351f | 2007-05-09 02:33:45 -0700 | [diff] [blame] | 63 | _enter("{%x:%u,%u}", |
| 64 | vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
| 66 | /* read the contents of the symlink into the pagecache */ |
Al Viro | f6d335c | 2010-05-21 15:27:09 +0100 | [diff] [blame] | 67 | page = read_cache_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, |
| 68 | afs_page_filler, key); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | if (IS_ERR(page)) { |
| 70 | ret = PTR_ERR(page); |
| 71 | goto out; |
| 72 | } |
| 73 | |
| 74 | ret = -EIO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | if (PageError(page)) |
| 76 | goto out_free; |
| 77 | |
Nick Piggin | 6fe6900 | 2007-05-06 14:49:04 -0700 | [diff] [blame] | 78 | buf = kmap(page); |
| 79 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | /* examine the symlink's contents */ |
| 81 | size = vnode->status.size; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 82 | _debug("symlink to %*.*s", (int) size, (int) size, buf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
| 84 | if (size > 2 && |
| 85 | (buf[0] == '%' || buf[0] == '#') && |
| 86 | buf[size - 1] == '.' |
| 87 | ) { |
| 88 | _debug("symlink is a mountpoint"); |
| 89 | spin_lock(&vnode->lock); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 90 | set_bit(AFS_VNODE_MOUNTPOINT, &vnode->flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | spin_unlock(&vnode->lock); |
| 92 | } |
| 93 | |
| 94 | ret = 0; |
| 95 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | kunmap(page); |
Nick Piggin | 6fe6900 | 2007-05-06 14:49:04 -0700 | [diff] [blame] | 97 | out_free: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | page_cache_release(page); |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 99 | out: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | _leave(" = %d", ret); |
| 101 | return ret; |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 102 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | /* |
| 105 | * no valid lookup procedure on this sort of dir |
| 106 | */ |
| 107 | static struct dentry *afs_mntpt_lookup(struct inode *dir, |
| 108 | struct dentry *dentry, |
| 109 | struct nameidata *nd) |
| 110 | { |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 111 | _enter("%p,%p{%p{%s},%s}", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | dir, |
| 113 | dentry, |
| 114 | dentry->d_parent, |
| 115 | dentry->d_parent ? |
| 116 | dentry->d_parent->d_name.name : (const unsigned char *) "", |
| 117 | dentry->d_name.name); |
| 118 | |
| 119 | return ERR_PTR(-EREMOTE); |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 120 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | /* |
| 123 | * no valid open procedure on this sort of dir |
| 124 | */ |
| 125 | static int afs_mntpt_open(struct inode *inode, struct file *file) |
| 126 | { |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 127 | _enter("%p,%p{%p{%s},%s}", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | inode, file, |
Josef Sipek | 1d56a96 | 2006-12-08 02:36:50 -0800 | [diff] [blame] | 129 | file->f_path.dentry->d_parent, |
| 130 | file->f_path.dentry->d_parent ? |
| 131 | file->f_path.dentry->d_parent->d_name.name : |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | (const unsigned char *) "", |
Josef Sipek | 1d56a96 | 2006-12-08 02:36:50 -0800 | [diff] [blame] | 133 | file->f_path.dentry->d_name.name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | |
| 135 | return -EREMOTE; |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 136 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | /* |
| 139 | * create a vfsmount to be automounted |
| 140 | */ |
| 141 | static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) |
| 142 | { |
| 143 | struct afs_super_info *super; |
| 144 | struct vfsmount *mnt; |
wanglei | bec5eb6 | 2010-08-11 09:38:04 +0100 | [diff] [blame] | 145 | struct afs_vnode *vnode; |
David Howells | 083fd8b | 2010-04-21 12:01:23 +0100 | [diff] [blame] | 146 | struct page *page; |
wanglei | bec5eb6 | 2010-08-11 09:38:04 +0100 | [diff] [blame] | 147 | char *devname, *options; |
| 148 | bool rwpath = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | int ret; |
| 150 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 151 | _enter("{%s}", mntpt->d_name.name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | |
| 153 | BUG_ON(!mntpt->d_inode); |
| 154 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | ret = -ENOMEM; |
| 156 | devname = (char *) get_zeroed_page(GFP_KERNEL); |
| 157 | if (!devname) |
David Howells | 083fd8b | 2010-04-21 12:01:23 +0100 | [diff] [blame] | 158 | goto error_no_devname; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | |
| 160 | options = (char *) get_zeroed_page(GFP_KERNEL); |
| 161 | if (!options) |
David Howells | 083fd8b | 2010-04-21 12:01:23 +0100 | [diff] [blame] | 162 | goto error_no_options; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
wanglei | bec5eb6 | 2010-08-11 09:38:04 +0100 | [diff] [blame] | 164 | vnode = AFS_FS_I(mntpt->d_inode); |
| 165 | if (test_bit(AFS_VNODE_PSEUDODIR, &vnode->flags)) { |
| 166 | /* if the directory is a pseudo directory, use the d_name */ |
| 167 | static const char afs_root_cell[] = ":root.cell."; |
| 168 | unsigned size = mntpt->d_name.len; |
| 169 | |
| 170 | ret = -ENOENT; |
| 171 | if (size < 2 || size > AFS_MAXCELLNAME) |
| 172 | goto error_no_page; |
| 173 | |
| 174 | if (mntpt->d_name.name[0] == '.') { |
| 175 | devname[0] = '#'; |
| 176 | memcpy(devname + 1, mntpt->d_name.name, size - 1); |
| 177 | memcpy(devname + size, afs_root_cell, |
| 178 | sizeof(afs_root_cell)); |
| 179 | rwpath = true; |
| 180 | } else { |
| 181 | devname[0] = '%'; |
| 182 | memcpy(devname + 1, mntpt->d_name.name, size); |
| 183 | memcpy(devname + size + 1, afs_root_cell, |
| 184 | sizeof(afs_root_cell)); |
| 185 | } |
| 186 | } else { |
| 187 | /* read the contents of the AFS special symlink */ |
| 188 | loff_t size = i_size_read(mntpt->d_inode); |
| 189 | char *buf; |
| 190 | |
| 191 | ret = -EINVAL; |
| 192 | if (size > PAGE_SIZE - 1) |
| 193 | goto error_no_page; |
| 194 | |
| 195 | page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL); |
| 196 | if (IS_ERR(page)) { |
| 197 | ret = PTR_ERR(page); |
| 198 | goto error_no_page; |
| 199 | } |
| 200 | |
| 201 | ret = -EIO; |
| 202 | if (PageError(page)) |
| 203 | goto error; |
| 204 | |
| 205 | buf = kmap_atomic(page, KM_USER0); |
| 206 | memcpy(devname, buf, size); |
| 207 | kunmap_atomic(buf, KM_USER0); |
| 208 | page_cache_release(page); |
| 209 | page = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | } |
| 211 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | /* work out what options we want */ |
| 213 | super = AFS_FS_S(mntpt->d_sb); |
| 214 | memcpy(options, "cell=", 5); |
| 215 | strcpy(options + 5, super->volume->cell->name); |
wanglei | bec5eb6 | 2010-08-11 09:38:04 +0100 | [diff] [blame] | 216 | if (super->volume->type == AFSVL_RWVOL || rwpath) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | strcat(options, ",rwpath"); |
| 218 | |
| 219 | /* try and do the mount */ |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 220 | _debug("--- attempting mount %s -o %s ---", devname, options); |
Trond Myklebust | 1f5ce9e | 2006-06-09 09:34:16 -0400 | [diff] [blame] | 221 | mnt = vfs_kern_mount(&afs_fs_type, 0, devname, options); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 222 | _debug("--- mount result %p ---", mnt); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | |
| 224 | free_page((unsigned long) devname); |
| 225 | free_page((unsigned long) options); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 226 | _leave(" = %p", mnt); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | return mnt; |
| 228 | |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 229 | error: |
David Howells | 083fd8b | 2010-04-21 12:01:23 +0100 | [diff] [blame] | 230 | page_cache_release(page); |
| 231 | error_no_page: |
| 232 | free_page((unsigned long) options); |
| 233 | error_no_options: |
| 234 | free_page((unsigned long) devname); |
| 235 | error_no_devname: |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 236 | _leave(" = %d", ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | return ERR_PTR(ret); |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 238 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | /* |
| 241 | * follow a link from a mountpoint directory, thus causing it to be mounted |
| 242 | */ |
Al Viro | 008b150 | 2005-08-20 00:17:39 +0100 | [diff] [blame] | 243 | static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | { |
| 245 | struct vfsmount *newmnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | int err; |
| 247 | |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 248 | _enter("%p{%s},{%s:%p{%s},}", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | dentry, |
| 250 | dentry->d_name.name, |
Jan Blunck | 4ac9137 | 2008-02-14 19:34:32 -0800 | [diff] [blame] | 251 | nd->path.mnt->mnt_devname, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | dentry, |
Jan Blunck | 4ac9137 | 2008-02-14 19:34:32 -0800 | [diff] [blame] | 253 | nd->path.dentry->d_name.name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | |
Jan Blunck | 4ac9137 | 2008-02-14 19:34:32 -0800 | [diff] [blame] | 255 | dput(nd->path.dentry); |
| 256 | nd->path.dentry = dget(dentry); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 257 | |
Jan Blunck | 4ac9137 | 2008-02-14 19:34:32 -0800 | [diff] [blame] | 258 | newmnt = afs_mntpt_do_automount(nd->path.dentry); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | if (IS_ERR(newmnt)) { |
Jan Blunck | 1d957f9 | 2008-02-14 19:34:35 -0800 | [diff] [blame] | 260 | path_put(&nd->path); |
Al Viro | 008b150 | 2005-08-20 00:17:39 +0100 | [diff] [blame] | 261 | return (void *)newmnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | } |
| 263 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 264 | mntget(newmnt); |
Al Viro | 8d66bf5 | 2008-08-01 09:05:54 -0400 | [diff] [blame] | 265 | err = do_add_mount(newmnt, &nd->path, MNT_SHRINKABLE, &afs_vfsmounts); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 266 | switch (err) { |
| 267 | case 0: |
Jan Blunck | 09da5916 | 2008-02-14 19:34:37 -0800 | [diff] [blame] | 268 | path_put(&nd->path); |
Jan Blunck | 4ac9137 | 2008-02-14 19:34:32 -0800 | [diff] [blame] | 269 | nd->path.mnt = newmnt; |
| 270 | nd->path.dentry = dget(newmnt->mnt_root); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 271 | schedule_delayed_work(&afs_mntpt_expiry_timer, |
| 272 | afs_mntpt_expiry_timeout * HZ); |
| 273 | break; |
| 274 | case -EBUSY: |
| 275 | /* someone else made a mount here whilst we were busy */ |
Jan Blunck | 4ac9137 | 2008-02-14 19:34:32 -0800 | [diff] [blame] | 276 | while (d_mountpoint(nd->path.dentry) && |
Al Viro | 9393bd0 | 2009-04-18 13:58:15 -0400 | [diff] [blame] | 277 | follow_down(&nd->path)) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 278 | ; |
| 279 | err = 0; |
| 280 | default: |
| 281 | mntput(newmnt); |
| 282 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | } |
| 284 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 285 | _leave(" = %d", err); |
Al Viro | 008b150 | 2005-08-20 00:17:39 +0100 | [diff] [blame] | 286 | return ERR_PTR(err); |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 287 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | /* |
| 290 | * handle mountpoint expiry timer going off |
| 291 | */ |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 292 | static void afs_mntpt_expiry_timed_out(struct work_struct *work) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | { |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 294 | _enter(""); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 296 | if (!list_empty(&afs_vfsmounts)) { |
| 297 | mark_mounts_for_expiry(&afs_vfsmounts); |
| 298 | schedule_delayed_work(&afs_mntpt_expiry_timer, |
| 299 | afs_mntpt_expiry_timeout * HZ); |
| 300 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 302 | _leave(""); |
| 303 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 305 | /* |
| 306 | * kill the AFS mountpoint timer if it's still running |
| 307 | */ |
| 308 | void afs_mntpt_kill_timer(void) |
| 309 | { |
| 310 | _enter(""); |
| 311 | |
| 312 | ASSERT(list_empty(&afs_vfsmounts)); |
| 313 | cancel_delayed_work(&afs_mntpt_expiry_timer); |
| 314 | flush_scheduled_work(); |
| 315 | } |