make get_file() return its argument
[pandora-kernel.git] / fs / autofs4 / waitq.c
index 6861f61..18d73ef 100644 (file)
@@ -90,24 +90,7 @@ static int autofs4_write(struct file *file, const void *addr, int bytes)
 
        return (bytes > 0);
 }
-
-/*
- * The autofs_v5 packet was misdesigned.
- *
- * The packets are identical on x86-32 and x86-64, but have different
- * alignment. Which means that 'sizeof()' will give different results.
- * Fix it up for the case of running 32-bit user mode on a 64-bit kernel.
- */
-static noinline size_t autofs_v5_packet_size(struct autofs_sb_info *sbi)
-{
-       size_t pktsz = sizeof(struct autofs_v5_packet);
-#if defined(CONFIG_X86_64) && defined(CONFIG_COMPAT)
-       if (sbi->compat_daemon > 0)
-               pktsz -= 4;
-#endif
-       return pktsz;
-}
-
+       
 static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
                                 struct autofs_wait_queue *wq,
                                 int type)
@@ -127,6 +110,13 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
 
        pkt.hdr.proto_version = sbi->version;
        pkt.hdr.type = type;
+       mutex_lock(&sbi->wq_mutex);
+
+       /* Check if we have become catatonic */
+       if (sbi->catatonic) {
+               mutex_unlock(&sbi->wq_mutex);
+               return;
+       }
        switch (type) {
        /* Kernel protocol v4 missing and expire packets */
        case autofs_ptype_missing:
@@ -164,7 +154,8 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
        {
                struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet;
 
-               pktsz = autofs_v5_packet_size(sbi);
+               pktsz = sizeof(*packet);
+
                packet->wait_queue_token = wq->wait_queue_token;
                packet->len = wq->name.len;
                memcpy(packet->name, wq->name.name, wq->name.len);
@@ -179,22 +170,17 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
        }
        default:
                printk("autofs4_notify_daemon: bad type %d!\n", type);
+               mutex_unlock(&sbi->wq_mutex);
                return;
        }
 
-       /* Check if we have become catatonic */
-       mutex_lock(&sbi->wq_mutex);
-       if (!sbi->catatonic) {
-               pipe = sbi->pipe;
-               get_file(pipe);
-       }
+       pipe = get_file(sbi->pipe);
+
        mutex_unlock(&sbi->wq_mutex);
 
-       if (pipe) {
-               if (autofs4_write(pipe, &pkt, pktsz))
-                       autofs4_catatonic_mode(sbi);
-               fput(pipe);
-       }
+       if (autofs4_write(pipe, &pkt, pktsz))
+               autofs4_catatonic_mode(sbi);
+       fput(pipe);
 }
 
 static int autofs4_getpath(struct autofs_sb_info *sbi,