@@ -1080,8 +1080,9 @@ static int check_owner(int type, int id)
return 0;
}
-int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
+int quotactl_ioctl(struct super_block *sb, struct if_quotactl *qctl)
{
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
int cmd = qctl->qc_cmd;
int type = qctl->qc_type;
int id = qctl->qc_id;
@@ -1097,6 +1098,9 @@ int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
case LUSTRE_Q_SETDEFAULT_POOL:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
+
+ if (sb->s_flags & SB_RDONLY)
+ return -EROFS;
break;
case Q_GETQUOTA:
case LUSTRE_Q_GETDEFAULT:
@@ -1873,7 +1877,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
}
- rc = quotactl_ioctl(sbi, qctl);
+ rc = quotactl_ioctl(inode->i_sb, qctl);
if (rc == 0 && copy_to_user((void __user *)arg, qctl,
sizeof(*qctl)))
rc = -EFAULT;
@@ -1080,7 +1080,7 @@ int ll_dir_read(struct inode *inode, u64 *ppos, struct md_op_data *op_data,
struct page *ll_get_dir_page(struct inode *dir, struct md_op_data *op_data,
u64 offset);
void ll_release_page(struct inode *inode, struct page *page, bool remove);
-int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl);
+int quotactl_ioctl(struct super_block *sb, struct if_quotactl *qctl);
enum get_default_layout_type {
GET_DEFAULT_LAYOUT_ROOT = 1,
@@ -2263,7 +2263,7 @@ static int ll_statfs_project(struct inode *inode, struct kstatfs *sfs)
int ret;
qctl.qc_id = ll_i2info(inode)->lli_projid;
- ret = quotactl_ioctl(ll_i2sbi(inode), &qctl);
+ ret = quotactl_ioctl(inode->i_sb, &qctl);
if (ret) {
/* ignore errors if project ID does not have
* a quota limit or feature unsupported.