Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* -*- c -*- --------------------------------------------------------------- * |
| 2 | * |
| 3 | * linux/fs/autofs/expire.c |
| 4 | * |
| 5 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved |
| 6 | * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> |
| 7 | * Copyright 2001-2003 Ian Kent <raven@themaw.net> |
| 8 | * |
| 9 | * This file is part of the Linux kernel and is made available under |
| 10 | * the terms of the GNU General Public License, version 2, or at your |
| 11 | * option, any later version, incorporated herein by reference. |
| 12 | * |
| 13 | * ------------------------------------------------------------------------- */ |
| 14 | |
| 15 | #include "autofs_i.h" |
| 16 | |
| 17 | static unsigned long now; |
| 18 | |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 19 | /* Check if a dentry can be expired */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | static inline int autofs4_can_expire(struct dentry *dentry, |
| 21 | unsigned long timeout, int do_now) |
| 22 | { |
| 23 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
| 24 | |
| 25 | /* dentry in the process of being deleted */ |
| 26 | if (ino == NULL) |
| 27 | return 0; |
| 28 | |
| 29 | /* No point expiring a pending mount */ |
| 30 | if (dentry->d_flags & DCACHE_AUTOFS_PENDING) |
| 31 | return 0; |
| 32 | |
| 33 | if (!do_now) { |
| 34 | /* Too young to die */ |
| 35 | if (time_after(ino->last_used + timeout, now)) |
| 36 | return 0; |
| 37 | |
| 38 | /* update last_used here :- |
| 39 | - obviously makes sense if it is in use now |
| 40 | - less obviously, prevents rapid-fire expire |
| 41 | attempts if expire fails the first time */ |
| 42 | ino->last_used = now; |
| 43 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | return 1; |
| 45 | } |
| 46 | |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 47 | /* Check a mount point for busyness */ |
| 48 | static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | { |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 50 | struct dentry *top = dentry; |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 51 | int status = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
| 53 | DPRINTK("dentry %p %.*s", |
| 54 | dentry, (int)dentry->d_name.len, dentry->d_name.name); |
| 55 | |
| 56 | mntget(mnt); |
| 57 | dget(dentry); |
| 58 | |
Ian Kent | 9b1e3af | 2005-06-21 17:16:38 -0700 | [diff] [blame] | 59 | if (!autofs4_follow_mount(&mnt, &dentry)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | goto done; |
| 61 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | /* This is an autofs submount, we can't expire it */ |
| 63 | if (is_autofs4_dentry(dentry)) |
| 64 | goto done; |
| 65 | |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 66 | /* Update the expiry counter if fs is busy */ |
| 67 | if (may_umount_tree(mnt)) { |
| 68 | struct autofs_info *ino = autofs4_dentry_ino(top); |
| 69 | ino->last_used = jiffies; |
| 70 | goto done; |
| 71 | } |
| 72 | |
| 73 | status = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | done: |
| 75 | DPRINTK("returning = %d", status); |
| 76 | mntput(mnt); |
| 77 | dput(dentry); |
| 78 | return status; |
| 79 | } |
| 80 | |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 81 | /* |
| 82 | * Calculate next entry in top down tree traversal. |
| 83 | * From next_mnt in namespace.c - elegant. |
| 84 | */ |
| 85 | static struct dentry *next_dentry(struct dentry *p, struct dentry *root) |
| 86 | { |
| 87 | struct list_head *next = p->d_subdirs.next; |
| 88 | |
| 89 | if (next == &p->d_subdirs) { |
| 90 | while (1) { |
| 91 | if (p == root) |
| 92 | return NULL; |
| 93 | next = p->d_u.d_child.next; |
| 94 | if (next != &p->d_parent->d_subdirs) |
| 95 | break; |
| 96 | p = p->d_parent; |
| 97 | } |
| 98 | } |
| 99 | return list_entry(next, struct dentry, d_u.d_child); |
| 100 | } |
| 101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | /* Check a directory tree of mount points for busyness |
| 103 | * The tree is not busy iff no mountpoints are busy |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | */ |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 105 | static int autofs4_tree_busy(struct vfsmount *mnt, |
| 106 | struct dentry *top, |
| 107 | unsigned long timeout, |
| 108 | int do_now) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | { |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 110 | struct autofs_info *top_ino = autofs4_dentry_ino(top); |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 111 | struct dentry *p; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 113 | DPRINTK("top %p %.*s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | top, (int)top->d_name.len, top->d_name.name); |
| 115 | |
| 116 | /* Negative dentry - give up */ |
| 117 | if (!simple_positive(top)) |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 118 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | spin_lock(&dcache_lock); |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 121 | for (p = top; p; p = next_dentry(p, top)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | /* Negative dentry - give up */ |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 123 | if (!simple_positive(p)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | continue; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | |
| 126 | DPRINTK("dentry %p %.*s", |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 127 | p, (int) p->d_name.len, p->d_name.name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 129 | p = dget(p); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | spin_unlock(&dcache_lock); |
| 131 | |
Ian Kent | 1aff3c8 | 2006-03-27 01:14:46 -0800 | [diff] [blame] | 132 | /* |
| 133 | * Is someone visiting anywhere in the subtree ? |
| 134 | * If there's no mount we need to check the usage |
| 135 | * count for the autofs dentry. |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 136 | * If the fs is busy update the expiry counter. |
Ian Kent | 1aff3c8 | 2006-03-27 01:14:46 -0800 | [diff] [blame] | 137 | */ |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 138 | if (d_mountpoint(p)) { |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 139 | if (autofs4_mount_busy(mnt, p)) { |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 140 | top_ino->last_used = jiffies; |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 141 | dput(p); |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 142 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | } |
Ian Kent | 1aff3c8 | 2006-03-27 01:14:46 -0800 | [diff] [blame] | 144 | } else { |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 145 | struct autofs_info *ino = autofs4_dentry_ino(p); |
Ian Kent | 1aff3c8 | 2006-03-27 01:14:46 -0800 | [diff] [blame] | 146 | unsigned int ino_count = atomic_read(&ino->count); |
| 147 | |
| 148 | /* allow for dget above and top is already dgot */ |
| 149 | if (p == top) |
| 150 | ino_count += 2; |
| 151 | else |
| 152 | ino_count++; |
| 153 | |
| 154 | if (atomic_read(&p->d_count) > ino_count) { |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 155 | top_ino->last_used = jiffies; |
Ian Kent | 1aff3c8 | 2006-03-27 01:14:46 -0800 | [diff] [blame] | 156 | dput(p); |
| 157 | return 1; |
| 158 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | } |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 160 | dput(p); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | spin_lock(&dcache_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | } |
| 163 | spin_unlock(&dcache_lock); |
Ian Kent | 1aff3c8 | 2006-03-27 01:14:46 -0800 | [diff] [blame] | 164 | |
| 165 | /* Timeout of a tree mount is ultimately determined by its top dentry */ |
| 166 | if (!autofs4_can_expire(top, timeout, do_now)) |
| 167 | return 1; |
| 168 | |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 169 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | static struct dentry *autofs4_check_leaves(struct vfsmount *mnt, |
| 173 | struct dentry *parent, |
| 174 | unsigned long timeout, |
| 175 | int do_now) |
| 176 | { |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 177 | struct dentry *p; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | |
| 179 | DPRINTK("parent %p %.*s", |
| 180 | parent, (int)parent->d_name.len, parent->d_name.name); |
| 181 | |
| 182 | spin_lock(&dcache_lock); |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 183 | for (p = parent; p; p = next_dentry(p, parent)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | /* Negative dentry - give up */ |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 185 | if (!simple_positive(p)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | continue; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | |
| 188 | DPRINTK("dentry %p %.*s", |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 189 | p, (int) p->d_name.len, p->d_name.name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 191 | p = dget(p); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | spin_unlock(&dcache_lock); |
| 193 | |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 194 | if (d_mountpoint(p)) { |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 195 | /* Can we umount this guy */ |
| 196 | if (autofs4_mount_busy(mnt, p)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | goto cont; |
| 198 | |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 199 | /* Can we expire this guy */ |
| 200 | if (autofs4_can_expire(p, timeout, do_now)) |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 201 | return p; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | } |
| 203 | cont: |
Ian Kent | 1ce12ba | 2006-03-27 01:14:45 -0800 | [diff] [blame] | 204 | dput(p); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | spin_lock(&dcache_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | } |
| 207 | spin_unlock(&dcache_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | return NULL; |
| 209 | } |
| 210 | |
| 211 | /* |
| 212 | * Find an eligible tree to time-out |
| 213 | * A tree is eligible if :- |
| 214 | * - it is unused by any user process |
| 215 | * - it has been unused for exp_timeout time |
| 216 | */ |
| 217 | static struct dentry *autofs4_expire(struct super_block *sb, |
| 218 | struct vfsmount *mnt, |
| 219 | struct autofs_sb_info *sbi, |
| 220 | int how) |
| 221 | { |
| 222 | unsigned long timeout; |
| 223 | struct dentry *root = sb->s_root; |
| 224 | struct dentry *expired = NULL; |
| 225 | struct list_head *next; |
| 226 | int do_now = how & AUTOFS_EXP_IMMEDIATE; |
| 227 | int exp_leaves = how & AUTOFS_EXP_LEAVES; |
| 228 | |
| 229 | if ( !sbi->exp_timeout || !root ) |
| 230 | return NULL; |
| 231 | |
| 232 | now = jiffies; |
| 233 | timeout = sbi->exp_timeout; |
| 234 | |
| 235 | spin_lock(&dcache_lock); |
| 236 | next = root->d_subdirs.next; |
| 237 | |
| 238 | /* On exit from the loop expire is set to a dgot dentry |
| 239 | * to expire or it's NULL */ |
| 240 | while ( next != &root->d_subdirs ) { |
Eric Dumazet | 5160ee6 | 2006-01-08 01:03:32 -0800 | [diff] [blame] | 241 | struct dentry *dentry = list_entry(next, struct dentry, d_u.d_child); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | |
| 243 | /* Negative dentry - give up */ |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 244 | if (!simple_positive(dentry)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | next = next->next; |
| 246 | continue; |
| 247 | } |
| 248 | |
| 249 | dentry = dget(dentry); |
| 250 | spin_unlock(&dcache_lock); |
| 251 | |
| 252 | /* Case 1: indirect mount or top level direct mount */ |
| 253 | if (d_mountpoint(dentry)) { |
| 254 | DPRINTK("checking mountpoint %p %.*s", |
| 255 | dentry, (int)dentry->d_name.len, dentry->d_name.name); |
| 256 | |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 257 | /* Can we umount this guy */ |
| 258 | if (autofs4_mount_busy(mnt, dentry)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | goto next; |
| 260 | |
Ian Kent | e0a7aae | 2006-03-27 01:14:47 -0800 | [diff] [blame^] | 261 | /* Can we expire this guy */ |
| 262 | if (autofs4_can_expire(dentry, timeout, do_now)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | expired = dentry; |
| 264 | break; |
| 265 | } |
| 266 | goto next; |
| 267 | } |
| 268 | |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 269 | if (simple_empty(dentry)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | goto next; |
| 271 | |
| 272 | /* Case 2: tree mount, expire iff entire tree is not busy */ |
| 273 | if (!exp_leaves) { |
Ian Kent | 3a9720c | 2005-05-01 08:59:17 -0700 | [diff] [blame] | 274 | /* Lock the tree as we must expire as a whole */ |
| 275 | spin_lock(&sbi->fs_lock); |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 276 | if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) { |
Ian Kent | 3a9720c | 2005-05-01 08:59:17 -0700 | [diff] [blame] | 277 | struct autofs_info *inf = autofs4_dentry_ino(dentry); |
| 278 | |
| 279 | /* Set this flag early to catch sys_chdir and the like */ |
| 280 | inf->flags |= AUTOFS_INF_EXPIRING; |
| 281 | spin_unlock(&sbi->fs_lock); |
| 282 | expired = dentry; |
| 283 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | } |
Ian Kent | 3a9720c | 2005-05-01 08:59:17 -0700 | [diff] [blame] | 285 | spin_unlock(&sbi->fs_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | /* Case 3: direct mount, expire individual leaves */ |
| 287 | } else { |
| 288 | expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); |
| 289 | if (expired) { |
| 290 | dput(dentry); |
| 291 | break; |
| 292 | } |
| 293 | } |
| 294 | next: |
| 295 | dput(dentry); |
| 296 | spin_lock(&dcache_lock); |
| 297 | next = next->next; |
| 298 | } |
| 299 | |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 300 | if (expired) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | DPRINTK("returning %p %.*s", |
| 302 | expired, (int)expired->d_name.len, expired->d_name.name); |
| 303 | spin_lock(&dcache_lock); |
| 304 | list_del(&expired->d_parent->d_subdirs); |
Eric Dumazet | 5160ee6 | 2006-01-08 01:03:32 -0800 | [diff] [blame] | 305 | list_add(&expired->d_parent->d_subdirs, &expired->d_u.d_child); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | spin_unlock(&dcache_lock); |
| 307 | return expired; |
| 308 | } |
| 309 | spin_unlock(&dcache_lock); |
| 310 | |
| 311 | return NULL; |
| 312 | } |
| 313 | |
| 314 | /* Perform an expiry operation */ |
| 315 | int autofs4_expire_run(struct super_block *sb, |
| 316 | struct vfsmount *mnt, |
| 317 | struct autofs_sb_info *sbi, |
| 318 | struct autofs_packet_expire __user *pkt_p) |
| 319 | { |
| 320 | struct autofs_packet_expire pkt; |
| 321 | struct dentry *dentry; |
| 322 | |
| 323 | memset(&pkt,0,sizeof pkt); |
| 324 | |
| 325 | pkt.hdr.proto_version = sbi->version; |
| 326 | pkt.hdr.type = autofs_ptype_expire; |
| 327 | |
| 328 | if ((dentry = autofs4_expire(sb, mnt, sbi, 0)) == NULL) |
| 329 | return -EAGAIN; |
| 330 | |
| 331 | pkt.len = dentry->d_name.len; |
| 332 | memcpy(pkt.name, dentry->d_name.name, pkt.len); |
| 333 | pkt.name[pkt.len] = '\0'; |
| 334 | dput(dentry); |
| 335 | |
| 336 | if ( copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire)) ) |
| 337 | return -EFAULT; |
| 338 | |
| 339 | return 0; |
| 340 | } |
| 341 | |
| 342 | /* Call repeatedly until it returns -EAGAIN, meaning there's nothing |
| 343 | more to be done */ |
| 344 | int autofs4_expire_multi(struct super_block *sb, struct vfsmount *mnt, |
| 345 | struct autofs_sb_info *sbi, int __user *arg) |
| 346 | { |
| 347 | struct dentry *dentry; |
| 348 | int ret = -EAGAIN; |
| 349 | int do_now = 0; |
| 350 | |
| 351 | if (arg && get_user(do_now, arg)) |
| 352 | return -EFAULT; |
| 353 | |
| 354 | if ((dentry = autofs4_expire(sb, mnt, sbi, do_now)) != NULL) { |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 355 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | |
| 357 | /* This is synchronous because it makes the daemon a |
| 358 | little easier */ |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 359 | ino->flags |= AUTOFS_INF_EXPIRING; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 361 | ino->flags &= ~AUTOFS_INF_EXPIRING; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | dput(dentry); |
| 363 | } |
Ian Kent | 1f5f2c3 | 2006-03-27 01:14:44 -0800 | [diff] [blame] | 364 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | return ret; |
| 366 | } |
| 367 | |