Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3719f34 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull quota, reiserfs, udf and ext2 updates from Jan Kara:
 "The branch contains changes to quota code so that it does not modify
  persistent flags in inode->i_flags (it was the only place in kernel
  doing that) and handle it inside filesystem's quotaon/off handlers
  instead.

  The branch also contains two UDF cleanups, a couple of reiserfs fixes
  and one fix for ext2 quota locking"

* 'generic' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  ext4: Improve comments in ext4_quota_{on|off}()
  udf: use kmap_atomic for memcpy copying
  udf: use octal for permissions
  quota: Remove dquot_quotactl_ops
  reiserfs: Remove i_attrs_to_sd_attrs()
  reiserfs: Remove useless setting of i_flags
  jfs: Remove jfs_get_inode_flags()
  ext2: Remove ext2_get_inode_flags()
  ext4: Remove ext4_get_inode_flags()
  quota: Stop setting IMMUTABLE and NOATIME flags on quota files
  jfs: Set flags on quota files directly
  ext2: Set flags on quota files directly
  reiserfs: Set flags on quota files directly
  ext4: Set flags on quota files directly
  reiserfs: Protect dquot_writeback_dquots() by s_umount semaphore
  reiserfs: Make cancel_old_flush() reliable
  ext2: Call dquot_writeback_dquots() with s_umount held
  reiserfs: avoid a -Wmaybe-uninitialized warning
parents 5133cd75 61a92987
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -779,7 +779,6 @@ extern void ext2_evict_inode(struct inode *);
extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
extern int ext2_setattr (struct dentry *, struct iattr *);
extern int ext2_setattr (struct dentry *, struct iattr *);
extern void ext2_set_inode_flags(struct inode *inode);
extern void ext2_set_inode_flags(struct inode *inode);
extern void ext2_get_inode_flags(struct ext2_inode_info *);
extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
		       u64 start, u64 len);
		       u64 start, u64 len);


@@ -796,7 +795,8 @@ void ext2_error(struct super_block *, const char *, const char *, ...);
extern __printf(3, 4)
extern __printf(3, 4)
void ext2_msg(struct super_block *, const char *, const char *, ...);
void ext2_msg(struct super_block *, const char *, const char *, ...);
extern void ext2_update_dynamic_rev (struct super_block *sb);
extern void ext2_update_dynamic_rev (struct super_block *sb);
extern void ext2_write_super (struct super_block *);
extern void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es,
			    int wait);


/*
/*
 * Inodes and files operations
 * Inodes and files operations
+1 −21
Original line number Original line Diff line number Diff line
@@ -1384,25 +1384,6 @@ void ext2_set_inode_flags(struct inode *inode)
		inode->i_flags |= S_DAX;
		inode->i_flags |= S_DAX;
}
}


/* Propagate flags from i_flags to EXT2_I(inode)->i_flags */
void ext2_get_inode_flags(struct ext2_inode_info *ei)
{
	unsigned int flags = ei->vfs_inode.i_flags;

	ei->i_flags &= ~(EXT2_SYNC_FL|EXT2_APPEND_FL|
			EXT2_IMMUTABLE_FL|EXT2_NOATIME_FL|EXT2_DIRSYNC_FL);
	if (flags & S_SYNC)
		ei->i_flags |= EXT2_SYNC_FL;
	if (flags & S_APPEND)
		ei->i_flags |= EXT2_APPEND_FL;
	if (flags & S_IMMUTABLE)
		ei->i_flags |= EXT2_IMMUTABLE_FL;
	if (flags & S_NOATIME)
		ei->i_flags |= EXT2_NOATIME_FL;
	if (flags & S_DIRSYNC)
		ei->i_flags |= EXT2_DIRSYNC_FL;
}

struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
{
{
	struct ext2_inode_info *ei;
	struct ext2_inode_info *ei;
@@ -1563,7 +1544,6 @@ static int __ext2_write_inode(struct inode *inode, int do_sync)
	if (ei->i_state & EXT2_STATE_NEW)
	if (ei->i_state & EXT2_STATE_NEW)
		memset(raw_inode, 0, EXT2_SB(sb)->s_inode_size);
		memset(raw_inode, 0, EXT2_SB(sb)->s_inode_size);


	ext2_get_inode_flags(ei);
	raw_inode->i_mode = cpu_to_le16(inode->i_mode);
	raw_inode->i_mode = cpu_to_le16(inode->i_mode);
	if (!(test_opt(sb, NO_UID32))) {
	if (!(test_opt(sb, NO_UID32))) {
		raw_inode->i_uid_low = cpu_to_le16(low_16_bits(uid));
		raw_inode->i_uid_low = cpu_to_le16(low_16_bits(uid));
@@ -1615,7 +1595,7 @@ static int __ext2_write_inode(struct inode *inode, int do_sync)
				EXT2_SET_RO_COMPAT_FEATURE(sb,
				EXT2_SET_RO_COMPAT_FEATURE(sb,
					EXT2_FEATURE_RO_COMPAT_LARGE_FILE);
					EXT2_FEATURE_RO_COMPAT_LARGE_FILE);
				spin_unlock(&EXT2_SB(sb)->s_lock);
				spin_unlock(&EXT2_SB(sb)->s_lock);
				ext2_write_super(sb);
				ext2_sync_super(sb, EXT2_SB(sb)->s_es, 1);
			}
			}
		}
		}
	}
	}
+0 −1
Original line number Original line Diff line number Diff line
@@ -29,7 +29,6 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)


	switch (cmd) {
	switch (cmd) {
	case EXT2_IOC_GETFLAGS:
	case EXT2_IOC_GETFLAGS:
		ext2_get_inode_flags(ei);
		flags = ei->i_flags & EXT2_FL_USER_VISIBLE;
		flags = ei->i_flags & EXT2_FL_USER_VISIBLE;
		return put_user(flags, (int __user *) arg);
		return put_user(flags, (int __user *) arg);
	case EXT2_IOC_SETFLAGS: {
	case EXT2_IOC_SETFLAGS: {
+80 −7
Original line number Original line Diff line number Diff line
@@ -36,8 +36,7 @@
#include "xattr.h"
#include "xattr.h"
#include "acl.h"
#include "acl.h"


static void ext2_sync_super(struct super_block *sb,
static void ext2_write_super(struct super_block *sb);
			    struct ext2_super_block *es, int wait);
static int ext2_remount (struct super_block * sb, int * flags, char * data);
static int ext2_remount (struct super_block * sb, int * flags, char * data);
static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf);
static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf);
static int ext2_sync_fs(struct super_block *sb, int wait);
static int ext2_sync_fs(struct super_block *sb, int wait);
@@ -123,13 +122,29 @@ void ext2_update_dynamic_rev(struct super_block *sb)
	 */
	 */
}
}


#ifdef CONFIG_QUOTA
static int ext2_quota_off(struct super_block *sb, int type);

static void ext2_quota_off_umount(struct super_block *sb)
{
	int type;

	for (type = 0; type < MAXQUOTAS; type++)
		ext2_quota_off(sb, type);
}
#else
static inline void ext2_quota_off_umount(struct super_block *sb)
{
}
#endif

static void ext2_put_super (struct super_block * sb)
static void ext2_put_super (struct super_block * sb)
{
{
	int db_count;
	int db_count;
	int i;
	int i;
	struct ext2_sb_info *sbi = EXT2_SB(sb);
	struct ext2_sb_info *sbi = EXT2_SB(sb);


	dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
	ext2_quota_off_umount(sb);


	if (sbi->s_mb_cache) {
	if (sbi->s_mb_cache) {
		ext2_xattr_destroy_cache(sbi->s_mb_cache);
		ext2_xattr_destroy_cache(sbi->s_mb_cache);
@@ -314,10 +329,23 @@ static int ext2_show_options(struct seq_file *seq, struct dentry *root)
#ifdef CONFIG_QUOTA
#ifdef CONFIG_QUOTA
static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off);
static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off);
static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off);
static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off);
static int ext2_quota_on(struct super_block *sb, int type, int format_id,
			 const struct path *path);
static struct dquot **ext2_get_dquots(struct inode *inode)
static struct dquot **ext2_get_dquots(struct inode *inode)
{
{
	return EXT2_I(inode)->i_dquot;
	return EXT2_I(inode)->i_dquot;
}
}

static const struct quotactl_ops ext2_quotactl_ops = {
	.quota_on	= ext2_quota_on,
	.quota_off	= ext2_quota_off,
	.quota_sync	= dquot_quota_sync,
	.get_state	= dquot_get_state,
	.set_info	= dquot_set_dqinfo,
	.get_dqblk	= dquot_get_dqblk,
	.set_dqblk	= dquot_set_dqblk,
	.get_nextdqblk	= dquot_get_next_dqblk,
};
#endif
#endif


static const struct super_operations ext2_sops = {
static const struct super_operations ext2_sops = {
@@ -1117,7 +1145,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)


#ifdef CONFIG_QUOTA
#ifdef CONFIG_QUOTA
	sb->dq_op = &dquot_operations;
	sb->dq_op = &dquot_operations;
	sb->s_qcop = &dquot_quotactl_ops;
	sb->s_qcop = &ext2_quotactl_ops;
	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
#endif
#endif


@@ -1194,7 +1222,7 @@ static void ext2_clear_super_error(struct super_block *sb)
	}
	}
}
}


static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es,
void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es,
		     int wait)
		     int wait)
{
{
	ext2_clear_super_error(sb);
	ext2_clear_super_error(sb);
@@ -1270,7 +1298,7 @@ static int ext2_unfreeze(struct super_block *sb)
	return 0;
	return 0;
}
}


void ext2_write_super(struct super_block *sb)
static void ext2_write_super(struct super_block *sb)
{
{
	if (!(sb->s_flags & MS_RDONLY))
	if (!(sb->s_flags & MS_RDONLY))
		ext2_sync_fs(sb, 1);
		ext2_sync_fs(sb, 1);
@@ -1548,6 +1576,51 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
	return len - towrite;
	return len - towrite;
}
}


static int ext2_quota_on(struct super_block *sb, int type, int format_id,
			 const struct path *path)
{
	int err;
	struct inode *inode;

	err = dquot_quota_on(sb, type, format_id, path);
	if (err)
		return err;

	inode = d_inode(path->dentry);
	inode_lock(inode);
	EXT2_I(inode)->i_flags |= EXT2_NOATIME_FL | EXT2_IMMUTABLE_FL;
	inode_set_flags(inode, S_NOATIME | S_IMMUTABLE,
			S_NOATIME | S_IMMUTABLE);
	inode_unlock(inode);
	mark_inode_dirty(inode);

	return 0;
}

static int ext2_quota_off(struct super_block *sb, int type)
{
	struct inode *inode = sb_dqopt(sb)->files[type];
	int err;

	if (!inode || !igrab(inode))
		goto out;

	err = dquot_quota_off(sb, type);
	if (err)
		goto out_put;

	inode_lock(inode);
	EXT2_I(inode)->i_flags &= ~(EXT2_NOATIME_FL | EXT2_IMMUTABLE_FL);
	inode_set_flags(inode, 0, S_NOATIME | S_IMMUTABLE);
	inode_unlock(inode);
	mark_inode_dirty(inode);
out_put:
	iput(inode);
	return err;
out:
	return dquot_quota_off(sb, type);
}

#endif
#endif


static struct file_system_type ext2_fs_type = {
static struct file_system_type ext2_fs_type = {
+0 −1
Original line number Original line Diff line number Diff line
@@ -2477,7 +2477,6 @@ extern int ext4_truncate(struct inode *);
extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length);
extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length);
extern int ext4_truncate_restart_trans(handle_t *, struct inode *, int nblocks);
extern int ext4_truncate_restart_trans(handle_t *, struct inode *, int nblocks);
extern void ext4_set_inode_flags(struct inode *);
extern void ext4_set_inode_flags(struct inode *);
extern void ext4_get_inode_flags(struct ext4_inode_info *);
extern int ext4_alloc_da_blocks(struct inode *inode);
extern int ext4_alloc_da_blocks(struct inode *inode);
extern void ext4_set_aops(struct inode *inode);
extern void ext4_set_aops(struct inode *inode);
extern int ext4_writepage_trans_blocks(struct inode *);
extern int ext4_writepage_trans_blocks(struct inode *);
Loading