eCryptfs: remove unnecessary BUG_ON
Michael Halcrow [Tue, 16 Oct 2007 08:28:00 +0000 (01:28 -0700)]
Andrew Morton wrote:
> > +     mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex);
> > +     BUG_ON(mount_crypt_stat->num_global_auth_toks == 0);
> > +     mutex_unlock(&mount_crypt_stat->global_auth_tok_list_mutex);
>
> That's odd-looking.  If it was a bug for num_global_auth_toks to be
> zero, and if that mutex protects num_global_auth_toks then as soon
> as the lock gets dropped, another thread can make
> num_global_auth_toks zero, hence the bug is present.  Perhaps?

That was serving as an internal sanity check that should not have made
it into the final patch set in the first place. This patch removes it.

Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

fs/ecryptfs/crypto.c

index 129ed13..14cc1f5 100644 (file)
@@ -1029,9 +1029,6 @@ int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry)
        int rc = 0;
 
        ecryptfs_set_default_crypt_stat_vals(crypt_stat, mount_crypt_stat);
-       mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex);
-       BUG_ON(mount_crypt_stat->num_global_auth_toks == 0);
-       mutex_unlock(&mount_crypt_stat->global_auth_tok_list_mutex);
        crypt_stat->flags |= ECRYPTFS_ENCRYPTED;
        crypt_stat->flags |= ECRYPTFS_KEY_VALID;
        ecryptfs_copy_mount_wide_flags_to_inode_flags(crypt_stat,