[PATCH] ecryptfs: make show_options reflect actual mount options

Previous thread: [PATCH/RFC -rt] local_bh_enable() is safe for irqs_disabled() by Kevin Hilman on Friday, December 7, 2007 - 9:41 pm. (1 message)

Next thread: 2.6.24-rc4-git5: Reported regressions from 2.6.23 by Rafael J. Wysocki on Friday, December 7, 2007 - 10:40 pm. (91 messages)
To: linux-kernel Mailing List <linux-kernel@...>
Cc: Andrew Morton <akpm@...>, Michael Halcrow <mhalcrow@...>
Date: Friday, December 7, 2007 - 10:06 pm

Change ecryptfs_show_options to reflect the actual mount
options in use. Note that this does away with the "dir="
output, which is not a valid mount option and appears to be
unused.

Mount options such as "ecryptfs_verbose" and
"ecryptfs_xattr_metadata" are somewhat indeterminate for
a given fs, but in any case the reported mount options can
be used in a new mount command to get the same behavior.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Acked-by: Michael Halcrow <mhalcrow@us.ibm.com>

---

Index: linux/fs/ecryptfs/super.c
===================================================================
--- linux.orig/fs/ecryptfs/super.c
+++ linux/fs/ecryptfs/super.c
@@ -157,32 +157,42 @@ static void ecryptfs_clear_inode(struct
/**
* ecryptfs_show_options
*
- * Prints the directory we are currently mounted over.
- * Returns zero on success; non-zero otherwise
+ * Prints the mount options for a given superblock.
+ * Returns zero; does not fail.
*/
static int ecryptfs_show_options(struct seq_file *m, struct vfsmount *mnt)
{
struct super_block *sb = mnt->mnt_sb;
- struct dentry *lower_root_dentry = ecryptfs_dentry_to_lower(sb->s_root);
- struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(sb->s_root);
- char *tmp_page;
- char *path;
- int rc = 0;
-
- tmp_page = (char *)__get_free_page(GFP_KERNEL);
- if (!tmp_page) {
- rc = -ENOMEM;
- goto out;
- }
- path = d_path(lower_root_dentry, lower_mnt, tmp_page, PAGE_SIZE);
- if (IS_ERR(path)) {
- rc = PTR_ERR(path);
- goto out;
+ struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
+ &ecryptfs_superblock_to_private(sb)->mount_crypt_stat;
+ struct ecryptfs_global_auth_tok *walker;
+
+ mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex);
+ list_for_each_entry(walker,
+ &mount_crypt_stat->global_auth_tok_list,
+ mount_crypt_stat_list) {
+ seq_printf(m, ",ecryptfs_sig=%s", walker->sig);
}
- seq_printf(m, ",dir=%s", path);
- free_page((unsi...

Previous thread: [PATCH/RFC -rt] local_bh_enable() is safe for irqs_disabled() by Kevin Hilman on Friday, December 7, 2007 - 9:41 pm. (1 message)

Next thread: 2.6.24-rc4-git5: Reported regressions from 2.6.23 by Rafael J. Wysocki on Friday, December 7, 2007 - 10:40 pm. (91 messages)