Bläddra i källkod

[PATCH] autofs: fix "busy inodes after umount..."

This patch for old autofs (version 3) cleans dentries which are not putted
after killing the automount daemon (it's analogue of recent patch for
autofs4).

Signed-off-by: Alexander Krizhanovsky <klx@yandex.ru>
Cc: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Alexander Krizhanovsky 19 år sedan
förälder
incheckning
f76baf9365
3 ändrade filer med 7 tillägg och 4 borttagningar
  1. 2 1
      fs/autofs/autofs_i.h
  2. 3 2
      fs/autofs/dirhash.c
  3. 2 1
      fs/autofs/inode.c

+ 2 - 1
fs/autofs/autofs_i.h

@@ -105,6 +105,7 @@ struct autofs_sb_info {
 	struct file *pipe;
 	struct file *pipe;
 	pid_t oz_pgrp;
 	pid_t oz_pgrp;
 	int catatonic;
 	int catatonic;
+	struct super_block *sb;
 	unsigned long exp_timeout;
 	unsigned long exp_timeout;
 	ino_t next_dir_ino;
 	ino_t next_dir_ino;
 	struct autofs_wait_queue *queues; /* Wait queue pointer */
 	struct autofs_wait_queue *queues; /* Wait queue pointer */
@@ -134,7 +135,7 @@ void autofs_hash_insert(struct autofs_dirhash *,struct autofs_dir_ent *);
 void autofs_hash_delete(struct autofs_dir_ent *);
 void autofs_hash_delete(struct autofs_dir_ent *);
 struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *,off_t *,struct autofs_dir_ent *);
 struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *,off_t *,struct autofs_dir_ent *);
 void autofs_hash_dputall(struct autofs_dirhash *);
 void autofs_hash_dputall(struct autofs_dirhash *);
-void autofs_hash_nuke(struct autofs_dirhash *);
+void autofs_hash_nuke(struct autofs_sb_info *);
 
 
 /* Expiration-handling functions */
 /* Expiration-handling functions */
 
 

+ 3 - 2
fs/autofs/dirhash.c

@@ -232,13 +232,13 @@ void autofs_hash_dputall(struct autofs_dirhash *dh)
 
 
 /* Delete everything.  This is used on filesystem destruction, so we
 /* Delete everything.  This is used on filesystem destruction, so we
    make no attempt to keep the pointers valid */
    make no attempt to keep the pointers valid */
-void autofs_hash_nuke(struct autofs_dirhash *dh)
+void autofs_hash_nuke(struct autofs_sb_info *sbi)
 {
 {
 	int i;
 	int i;
 	struct autofs_dir_ent *ent, *nent;
 	struct autofs_dir_ent *ent, *nent;
 
 
 	for ( i = 0 ; i < AUTOFS_HASH_SIZE ; i++ ) {
 	for ( i = 0 ; i < AUTOFS_HASH_SIZE ; i++ ) {
-		for ( ent = dh->h[i] ; ent ; ent = nent ) {
+		for ( ent = sbi->dirhash.h[i] ; ent ; ent = nent ) {
 			nent = ent->next;
 			nent = ent->next;
 			if ( ent->dentry )
 			if ( ent->dentry )
 				dput(ent->dentry);
 				dput(ent->dentry);
@@ -246,4 +246,5 @@ void autofs_hash_nuke(struct autofs_dirhash *dh)
 			kfree(ent);
 			kfree(ent);
 		}
 		}
 	}
 	}
+	shrink_dcache_sb(sbi->sb);
 }
 }

+ 2 - 1
fs/autofs/inode.c

@@ -27,7 +27,7 @@ static void autofs_put_super(struct super_block *sb)
 	if ( !sbi->catatonic )
 	if ( !sbi->catatonic )
 		autofs_catatonic_mode(sbi); /* Free wait queues, close pipe */
 		autofs_catatonic_mode(sbi); /* Free wait queues, close pipe */
 
 
-	autofs_hash_nuke(&sbi->dirhash);
+	autofs_hash_nuke(sbi);
 	for ( n = 0 ; n < AUTOFS_MAX_SYMLINKS ; n++ ) {
 	for ( n = 0 ; n < AUTOFS_MAX_SYMLINKS ; n++ ) {
 		if ( test_bit(n, sbi->symlink_bitmap) )
 		if ( test_bit(n, sbi->symlink_bitmap) )
 			kfree(sbi->symlink[n].data);
 			kfree(sbi->symlink[n].data);
@@ -148,6 +148,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
 	s->s_magic = AUTOFS_SUPER_MAGIC;
 	s->s_magic = AUTOFS_SUPER_MAGIC;
 	s->s_op = &autofs_sops;
 	s->s_op = &autofs_sops;
 	s->s_time_gran = 1;
 	s->s_time_gran = 1;
+	sbi->sb = s;
 
 
 	root_inode = iget(s, AUTOFS_ROOT_INO);
 	root_inode = iget(s, AUTOFS_ROOT_INO);
 	root = d_alloc_root(root_inode);
 	root = d_alloc_root(root_inode);