aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Drokin <green@linuxhacker.ru>2016-12-07 17:41:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-14 08:00:20 -0400
commit47b7257fc20fd7977325babbb13b9610ffca82a9 (patch)
treee25124c6c2b7e097b43e316f554fa7401ebe7f5c
parent0b77c687d4e0bdc6db9bedace1e6886504ea43ef (diff)
staging/lustre/llite: move root_squash from sysfs to debugfs
commit 4c13990e35b9f053857d4ad83bf0f58e612ec414 upstream. root_squash control got accidentally moved to sysfs instead of debugfs, and the write side of it was also broken expecting a userspace buffer. It contains both uid and gid values in a single file, so debugfs is a clear place for it. Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Fixes: c948390f10ccc "fix inconsistencies of root squash feature" Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/lustre/llite/lproc_llite.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 23fda9d98bff..13ec24d44b04 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -924,27 +924,29 @@ static ssize_t ll_unstable_stats_seq_write(struct file *file,
924} 924}
925LPROC_SEQ_FOPS(ll_unstable_stats); 925LPROC_SEQ_FOPS(ll_unstable_stats);
926 926
927static ssize_t root_squash_show(struct kobject *kobj, struct attribute *attr, 927static int ll_root_squash_seq_show(struct seq_file *m, void *v)
928 char *buf)
929{ 928{
930 struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, 929 struct super_block *sb = m->private;
931 ll_kobj); 930 struct ll_sb_info *sbi = ll_s2sbi(sb);
932 struct root_squash_info *squash = &sbi->ll_squash; 931 struct root_squash_info *squash = &sbi->ll_squash;
933 932
934 return sprintf(buf, "%u:%u\n", squash->rsi_uid, squash->rsi_gid); 933 seq_printf(m, "%u:%u\n", squash->rsi_uid, squash->rsi_gid);
934 return 0;
935} 935}
936 936
937static ssize_t root_squash_store(struct kobject *kobj, struct attribute *attr, 937static ssize_t ll_root_squash_seq_write(struct file *file,
938 const char *buffer, size_t count) 938 const char __user *buffer,
939 size_t count, loff_t *off)
939{ 940{
940 struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, 941 struct seq_file *m = file->private_data;
941 ll_kobj); 942 struct super_block *sb = m->private;
943 struct ll_sb_info *sbi = ll_s2sbi(sb);
942 struct root_squash_info *squash = &sbi->ll_squash; 944 struct root_squash_info *squash = &sbi->ll_squash;
943 945
944 return lprocfs_wr_root_squash(buffer, count, squash, 946 return lprocfs_wr_root_squash(buffer, count, squash,
945 ll_get_fsname(sbi->ll_sb, NULL, 0)); 947 ll_get_fsname(sb, NULL, 0));
946} 948}
947LUSTRE_RW_ATTR(root_squash); 949LPROC_SEQ_FOPS(ll_root_squash);
948 950
949static int ll_nosquash_nids_seq_show(struct seq_file *m, void *v) 951static int ll_nosquash_nids_seq_show(struct seq_file *m, void *v)
950{ 952{
@@ -997,6 +999,8 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
997 { "statahead_stats", &ll_statahead_stats_fops, NULL, 0 }, 999 { "statahead_stats", &ll_statahead_stats_fops, NULL, 0 },
998 { "unstable_stats", &ll_unstable_stats_fops, NULL }, 1000 { "unstable_stats", &ll_unstable_stats_fops, NULL },
999 { "sbi_flags", &ll_sbi_flags_fops, NULL, 0 }, 1001 { "sbi_flags", &ll_sbi_flags_fops, NULL, 0 },
1002 { .name = "root_squash",
1003 .fops = &ll_root_squash_fops },
1000 { .name = "nosquash_nids", 1004 { .name = "nosquash_nids",
1001 .fops = &ll_nosquash_nids_fops }, 1005 .fops = &ll_nosquash_nids_fops },
1002 { NULL } 1006 { NULL }
@@ -1027,7 +1031,6 @@ static struct attribute *llite_attrs[] = {
1027 &lustre_attr_max_easize.attr, 1031 &lustre_attr_max_easize.attr,
1028 &lustre_attr_default_easize.attr, 1032 &lustre_attr_default_easize.attr,
1029 &lustre_attr_xattr_cache.attr, 1033 &lustre_attr_xattr_cache.attr,
1030 &lustre_attr_root_squash.attr,
1031 NULL, 1034 NULL,
1032}; 1035};
1033 1036