Skip to content

Commit 99db6e4

Browse files
Eric SandeenLinus Torvalds
authored andcommitted
ecryptfs: make show_options reflect actual mount options
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. [akpm@linux-foundation.org: fix printk warning] Signed-off-by: Eric Sandeen <sandeen@redhat.com> Acked-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>
1 parent 8e3a6f1 commit 99db6e4

1 file changed

Lines changed: 31 additions & 21 deletions

File tree

‎fs/ecryptfs/super.c‎

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -156,32 +156,42 @@ static void ecryptfs_clear_inode(struct inode *inode)
156156
/**
157157
* ecryptfs_show_options
158158
*
159-
* Prints the directory we are currently mounted over.
160-
* Returns zero on success; non-zero otherwise
159+
* Prints the mount options for a given superblock.
160+
* Returns zero; does not fail.
161161
*/
162162
static int ecryptfs_show_options(struct seq_file *m, struct vfsmount *mnt)
163163
{
164164
struct super_block *sb = mnt->mnt_sb;
165-
struct dentry *lower_root_dentry = ecryptfs_dentry_to_lower(sb->s_root);
166-
struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(sb->s_root);
167-
char *tmp_page;
168-
char *path;
169-
int rc = 0;
170-
171-
tmp_page = (char *)__get_free_page(GFP_KERNEL);
172-
if (!tmp_page) {
173-
rc = -ENOMEM;
174-
goto out;
175-
}
176-
path = d_path(lower_root_dentry, lower_mnt, tmp_page, PAGE_SIZE);
177-
if (IS_ERR(path)) {
178-
rc = PTR_ERR(path);
179-
goto out;
165+
struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
166+
&ecryptfs_superblock_to_private(sb)->mount_crypt_stat;
167+
struct ecryptfs_global_auth_tok *walker;
168+
169+
mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex);
170+
list_for_each_entry(walker,
171+
&mount_crypt_stat->global_auth_tok_list,
172+
mount_crypt_stat_list) {
173+
seq_printf(m, ",ecryptfs_sig=%s", walker->sig);
180174
}
181-
seq_printf(m, ",dir=%s", path);
182-
free_page((unsigned long)tmp_page);
183-
out:
184-
return rc;
175+
mutex_unlock(&mount_crypt_stat->global_auth_tok_list_mutex);
176+
177+
/* Note this is global and probably shouldn't be a mount option */
178+
if (ecryptfs_verbosity)
179+
seq_printf(m, ",ecryptfs_debug=%d\n", ecryptfs_verbosity);
180+
181+
seq_printf(m, ",ecryptfs_cipher=%s",
182+
mount_crypt_stat->global_default_cipher_name);
183+
184+
if (mount_crypt_stat->global_default_cipher_key_size)
185+
seq_printf(m, ",ecryptfs_key_bytes=%zd",
186+
mount_crypt_stat->global_default_cipher_key_size);
187+
if (mount_crypt_stat->flags & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)
188+
seq_printf(m, ",ecryptfs_passthrough");
189+
if (mount_crypt_stat->flags & ECRYPTFS_XATTR_METADATA_ENABLED)
190+
seq_printf(m, ",ecryptfs_xattr_metadata");
191+
if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
192+
seq_printf(m, ",ecryptfs_encrypted_view");
193+
194+
return 0;
185195
}
186196

187197
const struct super_operations ecryptfs_sops = {

0 commit comments

Comments
 (0)