mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 03:50:53 +07:00
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: quota: Pass information that quota is stored in system file to userspace ext2: protect inode changes in the SETVERSION and SETFLAGS ioctls jbd: Issue cache flush after checkpointing
This commit is contained in:
commit
d2346963bf
@ -77,10 +77,11 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
flags = flags & EXT2_FL_USER_MODIFIABLE;
|
||||
flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE;
|
||||
ei->i_flags = flags;
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
|
||||
ext2_set_inode_flags(inode);
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
|
||||
mark_inode_dirty(inode);
|
||||
setflags_out:
|
||||
mnt_drop_write_file(filp);
|
||||
@ -88,20 +89,29 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
}
|
||||
case EXT2_IOC_GETVERSION:
|
||||
return put_user(inode->i_generation, (int __user *) arg);
|
||||
case EXT2_IOC_SETVERSION:
|
||||
case EXT2_IOC_SETVERSION: {
|
||||
__u32 generation;
|
||||
|
||||
if (!inode_owner_or_capable(inode))
|
||||
return -EPERM;
|
||||
ret = mnt_want_write_file(filp);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (get_user(inode->i_generation, (int __user *) arg)) {
|
||||
if (get_user(generation, (int __user *) arg)) {
|
||||
ret = -EFAULT;
|
||||
} else {
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
mark_inode_dirty(inode);
|
||||
goto setversion_out;
|
||||
}
|
||||
|
||||
mutex_lock(&inode->i_mutex);
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_generation = generation;
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
|
||||
mark_inode_dirty(inode);
|
||||
setversion_out:
|
||||
mnt_drop_write_file(filp);
|
||||
return ret;
|
||||
}
|
||||
case EXT2_IOC_GETRSVSZ:
|
||||
if (test_opt(inode->i_sb, RESERVATION)
|
||||
&& S_ISREG(inode->i_mode)
|
||||
|
@ -453,8 +453,6 @@ int log_do_checkpoint(journal_t *journal)
|
||||
*
|
||||
* Return <0 on error, 0 on success, 1 if there was nothing to clean up.
|
||||
*
|
||||
* Called with the journal lock held.
|
||||
*
|
||||
* This is the only part of the journaling code which really needs to be
|
||||
* aware of transaction aborts. Checkpointing involves writing to the
|
||||
* main filesystem area rather than to the journal, so it can proceed
|
||||
@ -472,13 +470,14 @@ int cleanup_journal_tail(journal_t *journal)
|
||||
if (is_journal_aborted(journal))
|
||||
return 1;
|
||||
|
||||
/* OK, work out the oldest transaction remaining in the log, and
|
||||
/*
|
||||
* OK, work out the oldest transaction remaining in the log, and
|
||||
* the log block it starts at.
|
||||
*
|
||||
* If the log is now empty, we need to work out which is the
|
||||
* next transaction ID we will write, and where it will
|
||||
* start. */
|
||||
|
||||
* start.
|
||||
*/
|
||||
spin_lock(&journal->j_state_lock);
|
||||
spin_lock(&journal->j_list_lock);
|
||||
transaction = journal->j_checkpoint_transactions;
|
||||
@ -504,7 +503,25 @@ int cleanup_journal_tail(journal_t *journal)
|
||||
spin_unlock(&journal->j_state_lock);
|
||||
return 1;
|
||||
}
|
||||
spin_unlock(&journal->j_state_lock);
|
||||
|
||||
/*
|
||||
* We need to make sure that any blocks that were recently written out
|
||||
* --- perhaps by log_do_checkpoint() --- are flushed out before we
|
||||
* drop the transactions from the journal. It's unlikely this will be
|
||||
* necessary, especially with an appropriately sized journal, but we
|
||||
* need this to guarantee correctness. Fortunately
|
||||
* cleanup_journal_tail() doesn't get called all that often.
|
||||
*/
|
||||
if (journal->j_flags & JFS_BARRIER)
|
||||
blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
|
||||
|
||||
spin_lock(&journal->j_state_lock);
|
||||
if (!tid_gt(first_tid, journal->j_tail_sequence)) {
|
||||
spin_unlock(&journal->j_state_lock);
|
||||
/* Someone else cleaned up journal so return 0 */
|
||||
return 0;
|
||||
}
|
||||
/* OK, update the superblock to recover the freed space.
|
||||
* Physical blocks come first: have we wrapped beyond the end of
|
||||
* the log? */
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/jbd.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/blkdev.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -263,6 +264,9 @@ int journal_recover(journal_t *journal)
|
||||
err2 = sync_blockdev(journal->j_fs_dev);
|
||||
if (!err)
|
||||
err = err2;
|
||||
/* Flush disk caches to get replayed data on the permanent storage */
|
||||
if (journal->j_flags & JFS_BARRIER)
|
||||
blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -2125,6 +2125,8 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
|
||||
mutex_unlock(&dqopt->dqio_mutex);
|
||||
goto out_file_init;
|
||||
}
|
||||
if (dqopt->flags & DQUOT_QUOTA_SYS_FILE)
|
||||
dqopt->info[type].dqi_flags |= DQF_SYS_FILE;
|
||||
mutex_unlock(&dqopt->dqio_mutex);
|
||||
spin_lock(&dq_state_lock);
|
||||
dqopt->flags |= dquot_state_flag(flags, type);
|
||||
@ -2464,7 +2466,7 @@ int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
|
||||
spin_lock(&dq_data_lock);
|
||||
ii->dqi_bgrace = mi->dqi_bgrace;
|
||||
ii->dqi_igrace = mi->dqi_igrace;
|
||||
ii->dqi_flags = mi->dqi_flags & DQF_MASK;
|
||||
ii->dqi_flags = mi->dqi_flags & DQF_GETINFO_MASK;
|
||||
ii->dqi_valid = IIF_ALL;
|
||||
spin_unlock(&dq_data_lock);
|
||||
mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
|
||||
@ -2490,8 +2492,8 @@ int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
|
||||
if (ii->dqi_valid & IIF_IGRACE)
|
||||
mi->dqi_igrace = ii->dqi_igrace;
|
||||
if (ii->dqi_valid & IIF_FLAGS)
|
||||
mi->dqi_flags = (mi->dqi_flags & ~DQF_MASK) |
|
||||
(ii->dqi_flags & DQF_MASK);
|
||||
mi->dqi_flags = (mi->dqi_flags & ~DQF_SETINFO_MASK) |
|
||||
(ii->dqi_flags & DQF_SETINFO_MASK);
|
||||
spin_unlock(&dq_data_lock);
|
||||
mark_info_dirty(sb, type);
|
||||
/* Force write to disk */
|
||||
|
@ -230,7 +230,11 @@ struct mem_dqinfo {
|
||||
struct super_block;
|
||||
|
||||
#define DQF_MASK 0xffff /* Mask for format specific flags */
|
||||
#define DQF_INFO_DIRTY_B 16
|
||||
#define DQF_GETINFO_MASK 0x1ffff /* Mask for flags passed to userspace */
|
||||
#define DQF_SETINFO_MASK 0xffff /* Mask for flags modifiable from userspace */
|
||||
#define DQF_SYS_FILE_B 16
|
||||
#define DQF_SYS_FILE (1 << DQF_SYS_FILE_B) /* Quota file stored as system file */
|
||||
#define DQF_INFO_DIRTY_B 31
|
||||
#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */
|
||||
|
||||
extern void mark_info_dirty(struct super_block *sb, int type);
|
||||
|
Loading…
Reference in New Issue
Block a user