Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[linux-2.6-block.git] / fs / autofs4 / autofs_i.h
index 8f7cdde4173358575b292088c7f085d71ba66232..0118d67221b218672c622fdd1927289c1d9459ed 100644 (file)
@@ -60,6 +60,11 @@ do {                                                 \
                current->pid, __func__, ##args);        \
 } while (0)
 
+struct rehash_entry {
+       struct task_struct *task;
+       struct list_head list;
+};
+
 /* Unified info structure.  This is pointed to by both the dentry and
    inode structures.  Each file in the filesystem has an instance of this
    structure.  It holds a reference to the dentry, so dentries are never
@@ -75,6 +80,9 @@ struct autofs_info {
        struct completion expire_complete;
 
        struct list_head active;
+       int active_count;
+       struct list_head rehash_list;
+
        struct list_head expiring;
 
        struct autofs_sb_info *sbi;
@@ -95,6 +103,8 @@ struct autofs_info {
 
 #define AUTOFS_INF_EXPIRING    (1<<0) /* dentry is in the process of expiring */
 #define AUTOFS_INF_MOUNTPOINT  (1<<1) /* mountpoint status for direct expire */
+#define AUTOFS_INF_PENDING     (1<<2) /* dentry pending mount */
+#define AUTOFS_INF_REHASH      (1<<3) /* dentry in transit to ->lookup() */
 
 struct autofs_wait_queue {
        wait_queue_head_t queue;
@@ -161,7 +171,7 @@ static inline int autofs4_ispending(struct dentry *dentry)
 {
        struct autofs_info *inf = autofs4_dentry_ino(dentry);
 
-       if (dentry->d_flags & DCACHE_AUTOFS_PENDING)
+       if (inf->flags & AUTOFS_INF_PENDING)
                return 1;
 
        if (inf->flags & AUTOFS_INF_EXPIRING)
@@ -264,5 +274,31 @@ out:
        return ret;
 }
 
+static inline void autofs4_add_expiring(struct dentry *dentry)
+{
+       struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
+       struct autofs_info *ino = autofs4_dentry_ino(dentry);
+       if (ino) {
+               spin_lock(&sbi->lookup_lock);
+               if (list_empty(&ino->expiring))
+                       list_add(&ino->expiring, &sbi->expiring_list);
+               spin_unlock(&sbi->lookup_lock);
+       }
+       return;
+}
+
+static inline void autofs4_del_expiring(struct dentry *dentry)
+{
+       struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
+       struct autofs_info *ino = autofs4_dentry_ino(dentry);
+       if (ino) {
+               spin_lock(&sbi->lookup_lock);
+               if (!list_empty(&ino->expiring))
+                       list_del_init(&ino->expiring);
+               spin_unlock(&sbi->lookup_lock);
+       }
+       return;
+}
+
 void autofs4_dentry_release(struct dentry *);
 extern void autofs4_kill_sb(struct super_block *);