瀏覽代碼

pull bumping refcount into ->kill()

there will be one more change of ->kill() calling conventions; this
isn't final.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Al Viro 10 年之前
父節點
當前提交
32426f6653
共有 2 個文件被更改,包括 6 次插入12 次删除
  1. 0 12
      fs/fs_pin.c
  2. 6 0
      kernel/acct.c

+ 0 - 12
fs/fs_pin.c

@@ -34,12 +34,6 @@ void mnt_pin_kill(struct mount *m)
 			break;
 			break;
 		}
 		}
 		pin = hlist_entry(p, struct fs_pin, m_list);
 		pin = hlist_entry(p, struct fs_pin, m_list);
-		if (!atomic_long_inc_not_zero(&pin->count)) {
-			rcu_read_unlock();
-			cpu_relax();
-			continue;
-		}
-		rcu_read_unlock();
 		pin->kill(pin);
 		pin->kill(pin);
 	}
 	}
 }
 }
@@ -56,12 +50,6 @@ void sb_pin_kill(struct super_block *sb)
 			break;
 			break;
 		}
 		}
 		pin = hlist_entry(p, struct fs_pin, s_list);
 		pin = hlist_entry(p, struct fs_pin, s_list);
-		if (!atomic_long_inc_not_zero(&pin->count)) {
-			rcu_read_unlock();
-			cpu_relax();
-			continue;
-		}
-		rcu_read_unlock();
 		pin->kill(pin);
 		pin->kill(pin);
 	}
 	}
 }
 }

+ 6 - 0
kernel/acct.c

@@ -189,6 +189,12 @@ static void acct_pin_kill(struct fs_pin *pin)
 {
 {
 	struct bsd_acct_struct *acct;
 	struct bsd_acct_struct *acct;
 	acct = container_of(pin, struct bsd_acct_struct, pin);
 	acct = container_of(pin, struct bsd_acct_struct, pin);
+	if (!atomic_long_inc_not_zero(&pin->count)) {
+		rcu_read_unlock();
+		cpu_relax();
+		return;
+	}
+	rcu_read_unlock();
 	mutex_lock(&acct->lock);
 	mutex_lock(&acct->lock);
 	if (!acct->ns) {
 	if (!acct->ns) {
 		mutex_unlock(&acct->lock);
 		mutex_unlock(&acct->lock);