Skip to contentSkip to conversation

Linux 2.6.31.8

DISCUSSION Greg KH 1 participant 2 messages Dec 14, 2009

Subsystems (10)
Documentation SCSI Kbuild Tracing +6 more subsystems
lore
Share & tools
lore

Greg KH

author
#0 lore raw

I'm announcing the release of the 2.6.31.8 kernel. All users of the 2.6.31 kernel series are very strongly encouraged to upgrade.

I'll also be replying to this message with a copy of the patch between 2.6.31.7 and 2.6.31.8

The updated 2.6.31.y git tree can be found at:

        git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.31.y.git
and can be browsed at the normal kernel.org git web browser:
        http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.31.y.git;a=summary

thanks,

greg k-h

------------

 Documentation/filesystems/ext4.txt   |   10 
 Makefile                             |    2 
 drivers/scsi/hosts.c                 |   13 
 drivers/scsi/lpfc/lpfc_init.c        |    2 
 drivers/scsi/megaraid/megaraid_sas.c |    8 
 drivers/scsi/qla2xxx/qla_attr.c      |    3 
 drivers/scsi/scsi_lib_dma.c          |    4 
 fs/ext4/balloc.c                     |    8 
 fs/ext4/block_validity.c             |    2 
 fs/ext4/ext4.h                       |  105 ++++-
 fs/ext4/ext4_extents.h               |    7 
 fs/ext4/ext4_jbd2.c                  |    9 
 fs/ext4/ext4_jbd2.h                  |   27 +
 fs/ext4/extents.c                    |  493 ++++++++++++++++++++++--
 fs/ext4/fsync.c                      |   54 +-
 fs/ext4/inode.c                      |  705 ++++++++++++++++++++++++++++++-----
 fs/ext4/ioctl.c                      |   32 -
 fs/ext4/mballoc.c                    |  322 ++++++++-------
 fs/ext4/migrate.c                    |   28 -
 fs/ext4/move_extent.c                |  572 ++++++++++++++++------------
 fs/ext4/namei.c                      |   47 +-
 fs/ext4/resize.c                     |    2 
 fs/ext4/super.c                      |  239 ++++++++---
 fs/ext4/xattr.c                      |   22 -
 fs/jbd2/commit.c                     |    4 
 fs/jbd2/journal.c                    |   11 
 fs/jbd2/transaction.c                |    7 
 include/linux/sched.h                |   13 
 include/scsi/osd_protocol.h          |    1 
 include/scsi/scsi_host.h             |   16 
 include/trace/events/ext4.h          |   60 ++
 31 files changed, 2083 insertions(+), 745 deletions(-)

Akira Fujita (14):
ext4: Fix wrong comparisons in mext_check_arguments()
ext4: Remove unneeded BUG_ON() in ext4_move_extents()
ext4: Return exchanged blocks count to user space in failure
ext4: Fix small typo for move_extent_per_page()
ext4: Replace get_ext_path macro with an inline funciton
ext4: Replace BUG_ON() with ext4_error() in move_extents.c
ext4: Add null extent check to ext_get_path
ext4: Fix different block exchange issue in EXT4_IOC_MOVE_EXT
ext4: fix the returned block count if EXT4_IOC_MOVE_EXT fails
ext4: fix lock order problem in ext4_move_extents()
ext4: fix possible recursive locking warning in EXT4_IOC_MOVE_EXT
ext4: Fix double-free of blocks with EXT4_IOC_MOVE_EXT
ext4: move_extent_per_page() cleanup
ext4: Fix insufficient checks in EXT4_IOC_MOVE_EXT

Andreas Dilger (1):
jbd2: round commit timer up to avoid uncommitted transaction

Andreas Schlick (1):
ext4: Always set dx_node's fake_dirent explicitly.

Aneesh Kumar K.V (7):
ext4: Fix memory leak fix when mounting an ext4 filesystem
ext4: Add missing unlock_new_inode() call in extent migration code
ext4: Allow rename to create more than EXT4_LINK_MAX subdirectories
ext4: Take page lock before looking at attached buffer_heads flags
ext4: move ext4_mb_init_group() function earlier in the mballoc.c
ext4: check for need init flag in ext4_mb_load_buddy
ext4: discard preallocation when restarting a transaction during truncate

Christoph Hellwig (1):
ext4: fix cache flush in ext4_sync_file

Curt Wohlgemuth (3):
ext4: Make sure ext4_dirty_inode() updates the inode in no journal mode
ext4: Handle nested ext4_journal_start/stop calls without a journal
ext4: remove blocks from inode prealloc list on failure

Dmitry Monakhov (3):
ext4: ext4_get_reserved_space() must return bytes instead of blocks
ext4: quota macros cleanup
ext4: fix incorrect block reservation on quota transfer.

Eric Sandeen (7):
ext4: reject too-large filesystems on 32-bit kernels
ext4: Add feature set check helper for mount & remount paths
ext4: limit block allocations for indirect-block files to < 2^32
ext4: retry failed direct IO allocations
ext4: journal all modifications in ext4_xattr_set_handle
ext4: make trim/discard optional (and off by default)
ext4: make "norecovery" an alias for "noload"

Frank Mayhar (2):
ext4: Make non-journal fsync work properly
ext4: Avoid updating the inode table bh twice in no journal mode

Greg Kroah-Hartman (1):

      Linux 2.6.31.8

James Bottomley (1):
SCSI: scsi_lib_dma: fix bug with dma maps on nested scsi objects

Jan Kara (6):
jbd2: Fail to load a journal if it is too short
jbd2: Annotate transaction start also for jbd2_journal_restart()
ext4: Fix possible deadlock between ext4_truncate() and ext4_get_blocks()
ext4: fix error handling in ext4_ind_get_blocks()
ext4: Avoid data / filesystem corruption when write fails to copy data
ext4: Wait for proper transaction commit on fsync

Josef Bacik (1):
ext4: wait for log to commit when umounting

Julia Lawall (1):
ext4: fix i_flags access in ext4_da_writepages_trans_blocks()

Kazuya Mio (1):
ext4: initialize moved_len before calling ext4_move_extents()

Martin Michlmayr (1):
SCSI: osd_protocol.h: Add missing #include

Mingming (4):
ext4: fix ext4_ext_direct_IO()'s return value after converting uninit extents
ext4: skip conversion of uninit extents after direct IO if there isn't any
ext4: code clean up for dio fallocate handling
ext4: Fix return value of ext4_split_unwritten_extents() to fix direct I/O

Mingming Cao (4):
ext4: release reserved quota when block reservation for delalloc retry
ext4: Split uninitialized extents for direct I/O
ext4: Use end_io callback to avoid direct I/O fallback to buffered I/O
ext4: async direct IO for holes and fallocate support

Peng Tao (1):
ext4: fix journal ref count in move_extent_par_page

Roel Kluin (1):
ext4: Return the PTR_ERR of the correct pointer in setup_new_group_blocks()

Sebastian Andrzej Siewior (1):
signal: Fix alternate signal stack check

Theodore Ts'o (28):
ext4: Avoid null pointer dereference when decoding EROFS w/o a journal
ext4: Fix bugs in mballoc's stream allocation mode
ext4: Avoid group preallocation for closed files
ext4: Limit number of links that can be created by ext4_link()
ext4: Restore wbc->range_start in ext4_da_writepages()
ext4: print more sysadmin-friendly message in check_block_validity()
ext4: Use bforget() in no journal mode for ext4_journal_{forget,revoke}()
ext4: Assure that metadata blocks are written during fsync in no journal mode
ext4: Don't update superblock write time when filesystem is read-only
ext4: Fix initalization of s_flex_groups
ext4: Fix include/trace/events/ext4.h to work with Systemtap
ext4: store EXT4_EXT_MIGRATE in i_state instead of i_flags
ext4: Fix the alloc on close after a truncate hueristic
ext4: Fix hueristic which avoids group preallocation for closed files
ext4: Adjust ext4_da_writepages() to write out larger contiguous chunks
ext4: EXT4_IOC_MOVE_EXT: Check for different original and donor inodes first
ext4: Fix time encoding with extra epoch bits
ext4: fix a BUG_ON crash by checking that page has buffers attached to it
ext4: fix potential buffer head leak when add_dirent_to_buf() returns ENOSPC
ext4: avoid divide by zero when trying to mount a corrupted file system
ext4: plug a buffer_head leak in an error path of ext4_iget()
ext4: make sure directory and symlink blocks are revoked
ext4: don't update the superblock in ext4_statfs()
ext4: fix uninit block bitmap initialization when s_meta_first_bg is non-zero
ext4: fix block validity checks so they work correctly with meta_bg
ext4: avoid issuing unnecessary barriers
jbd2: Add ENOMEM checking in and for jbd2_journal_write_metadata_buffer()
ext4: Fix potential fiemap deadlock (mmap_sem vs. i_data_sem)

Yang, Bo (1):
SCSI: megaraid_sas: fix 64 bit sense pointer truncation

author
#1 lore raw
Documentation/filesystems/ext4.txt +8 -2
index 7be02ac..32c3da4 100644
@@ -153,8 +153,8 @@ journal_dev=devnum	When the external journal device's major/minor numbers
 			identified through its new major/minor numbers encoded
 			in devnum.
 
-noload			Don't load the journal on mounting.  Note that
-                     	if the filesystem was not unmounted cleanly,
+norecovery		Don't load the journal on mounting.  Note that
+noload			if the filesystem was not unmounted cleanly,
                      	skipping the journal replay will lead to the
                      	filesystem containing inconsistencies that can
                      	lead to any number of problems.
@@ -338,6 +338,12 @@ noauto_da_alloc		replacing existing files via patterns such as
 			system crashes before the delayed allocation
 			blocks are forced to disk.
 
+discard		Controls whether ext4 should issue discard/TRIM
+nodiscard(*)		commands to the underlying block device when
+			blocks are freed.  This is useful for SSD devices
+			and sparse/thinly-provisioned LUNs, but it is off
+			by default until sufficient testing has been done.
+
 Data Mode
 =========
 There are 3 different data modes:
Makefile +1 -1
index 2e405c8..6eefb00 100644
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 31
-EXTRAVERSION = .7
+EXTRAVERSION = .8
 NAME = Man-Eating Seals of Antiquity
 
 # *DOCUMENTATION*
drivers/scsi/hosts.c +10 -3
index 5fd2da4..28a753d 100644
@@ -180,14 +180,20 @@ void scsi_remove_host(struct Scsi_Host *shost)
 EXPORT_SYMBOL(scsi_remove_host);
 
 /**
- * scsi_add_host - add a scsi host
+ * scsi_add_host_with_dma - add a scsi host with dma device
  * @shost:	scsi host pointer to add
  * @dev:	a struct device of type scsi class
+ * @dma_dev:	dma device for the host
+ *
+ * Note: You rarely need to worry about this unless you're in a
+ * virtualised host environments, so use the simpler scsi_add_host()
+ * function instead.
  *
  * Return value: 
  * 	0 on success / != 0 for error
  **/
-int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
+int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
+			   struct device *dma_dev)
 {
 	struct scsi_host_template *sht = shost->hostt;
 	int error = -EINVAL;
@@ -207,6 +213,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
 
 	if (!shost->shost_gendev.parent)
 		shost->shost_gendev.parent = dev ? dev : &platform_bus;
+	shost->dma_dev = dma_dev;
 
 	error = device_add(&shost->shost_gendev);
 	if (error)
@@ -262,7 +269,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
  fail:
 	return error;
 }
-EXPORT_SYMBOL(scsi_add_host);
+EXPORT_SYMBOL(scsi_add_host_with_dma);
 
 static void scsi_host_dev_release(struct device *dev)
 {
drivers/scsi/lpfc/lpfc_init.c +1 -1
index fc67cc6..cf13ff2 100644
@@ -2384,7 +2384,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
 	vport->els_tmofunc.function = lpfc_els_timeout;
 	vport->els_tmofunc.data = (unsigned long)vport;
 
-	error = scsi_add_host(shost, dev);
+	error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev);
 	if (error)
 		goto out_put_shost;
 
drivers/scsi/megaraid/megaraid_sas.c +4 -4
index 7dc3d18..7a838c8 100644
@@ -3032,7 +3032,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 	int error = 0, i;
 	void *sense = NULL;
 	dma_addr_t sense_handle;
-	u32 *sense_ptr;
+	unsigned long *sense_ptr;
 
 	memset(kbuff_arr, 0, sizeof(kbuff_arr));
 
@@ -3109,7 +3109,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 		}
 
 		sense_ptr =
-		    (u32 *) ((unsigned long)cmd->frame + ioc->sense_off);
+		(unsigned long *) ((unsigned long)cmd->frame + ioc->sense_off);
 		*sense_ptr = sense_handle;
 	}
 
@@ -3140,8 +3140,8 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 		 * sense_ptr points to the location that has the user
 		 * sense buffer address
 		 */
-		sense_ptr = (u32 *) ((unsigned long)ioc->frame.raw +
-				     ioc->sense_off);
+		sense_ptr = (unsigned long *) ((unsigned long)ioc->frame.raw +
+				ioc->sense_off);
 
 		if (copy_to_user((void __user *)((unsigned long)(*sense_ptr)),
 				 sense, ioc->sense_len)) {
drivers/scsi/qla2xxx/qla_attr.c +2 -1
index 0f87962..67e016d 100644
@@ -1654,7 +1654,8 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
 			fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN);
 	}
 
-	if (scsi_add_host(vha->host, &fc_vport->dev)) {
+	if (scsi_add_host_with_dma(vha->host, &fc_vport->dev,
+				   &ha->pdev->dev)) {
 		DEBUG15(printk("scsi(%ld): scsi_add_host failure for VP[%d].\n",
 			vha->host_no, vha->vp_idx));
 		goto vport_create_failed_2;
drivers/scsi/scsi_lib_dma.c +2 -2
index ac6855c..dcd1285 100644
@@ -23,7 +23,7 @@ int scsi_dma_map(struct scsi_cmnd *cmd)
 	int nseg = 0;
 
 	if (scsi_sg_count(cmd)) {
-		struct device *dev = cmd->device->host->shost_gendev.parent;
+		struct device *dev = cmd->device->host->dma_dev;
 
 		nseg = dma_map_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd),
 				  cmd->sc_data_direction);
@@ -41,7 +41,7 @@ EXPORT_SYMBOL(scsi_dma_map);
 void scsi_dma_unmap(struct scsi_cmnd *cmd)
 {
 	if (scsi_sg_count(cmd)) {
-		struct device *dev = cmd->device->host->shost_gendev.parent;
+		struct device *dev = cmd->device->host->dma_dev;
 
 		dma_unmap_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd),
 			     cmd->sc_data_direction);
fs/ext4/balloc.c +7 -1
index e2126d7..34bb797 100644
@@ -761,7 +761,13 @@ static unsigned long ext4_bg_num_gdb_meta(struct super_block *sb,
 static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb,
 					ext4_group_t group)
 {
-	return ext4_bg_has_super(sb, group) ? EXT4_SB(sb)->s_gdb_count : 0;
+	if (!ext4_bg_has_super(sb, group))
+		return 0;
+
+	if (EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG))
+		return le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg);
+	else
+		return EXT4_SB(sb)->s_gdb_count;
 }
 
 /**
fs/ext4/block_validity.c +1 -1
index 50784ef..dc79b75 100644
@@ -160,7 +160,7 @@ int ext4_setup_system_zone(struct super_block *sb)
 		if (ext4_bg_has_super(sb, i) &&
 		    ((i < 5) || ((i % flex_size) == 0)))
 			add_system_zone(sbi, ext4_group_first_block_no(sb, i),
-					sbi->s_gdb_count + 1);
+					ext4_bg_num_gdb(sb, i) + 1);
 		gdp = ext4_get_group_desc(sb, i, NULL);
 		ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1);
 		if (ret)
fs/ext4/ext4.h +98 -7

221 lines not on this page · raw message

fs/ext4/ext4_extents.h +6 -1
index 20a8410..1c2db3f 100644
@@ -220,6 +220,11 @@ static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
 		(le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
 }
 
+static inline void ext4_ext_mark_initialized(struct ext4_extent *ext)
+{
+	ext->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ext));
+}
+
 extern int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks);
 extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex);
 extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
@@ -235,7 +240,7 @@ extern int ext4_ext_try_to_merge(struct inode *inode,
 				 struct ext4_ext_path *path,
 				 struct ext4_extent *);
 extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
-extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
+extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *, int);
 extern int ext4_ext_walk_space(struct inode *, ext4_lblk_t, ext4_lblk_t,
 							ext_prepare_callback, void *);
 extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
fs/ext4/ext4_jbd2.c +6 -3
index eb27fd0..6a94099 100644
@@ -44,7 +44,7 @@ int __ext4_journal_forget(const char *where, handle_t *handle,
 						  handle, err);
 	}
 	else
-		brelse(bh);
+		bforget(bh);
 	return err;
 }
 
@@ -60,7 +60,7 @@ int __ext4_journal_revoke(const char *where, handle_t *handle,
 						  handle, err);
 	}
 	else
-		brelse(bh);
+		bforget(bh);
 	return err;
 }
 
@@ -89,7 +89,10 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
 			ext4_journal_abort_handle(where, __func__, bh,
 						  handle, err);
 	} else {
-		mark_buffer_dirty(bh);
+		if (inode && bh)
+			mark_buffer_dirty_inode(bh, inode);
+		else
+			mark_buffer_dirty(bh);
 		if (inode && inode_needs_sync(inode)) {
 			sync_dirty_buffer(bh);
 			if (buffer_req(bh) && !buffer_uptodate(bh)) {
fs/ext4/ext4_jbd2.h +23 -4
index 139fb8c..1892a77 100644
@@ -49,7 +49,7 @@
 
 #define EXT4_DATA_TRANS_BLOCKS(sb)	(EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + \
 					 EXT4_XATTR_TRANS_BLOCKS - 2 + \
-					 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
+					 EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))
 
 /*
  * Define the number of metadata blocks we need to account to modify data.
@@ -57,7 +57,7 @@
  * This include super block, inode block, quota blocks and xattr blocks
  */
 #define EXT4_META_TRANS_BLOCKS(sb)	(EXT4_XATTR_TRANS_BLOCKS + \
-					2*EXT4_QUOTA_TRANS_BLOCKS(sb))
+					EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))
 
 /* Delete operations potentially hit one directory's namespace plus an
  * entire inode, plus arbitrary amounts of bitmap/indirection data.  Be
@@ -92,6 +92,7 @@
  * but inode, sb and group updates are done only once */
 #define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
 		(EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_INIT_REWRITE) : 0)
+
 #define EXT4_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
 		(EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_DEL_REWRITE) : 0)
 #else
@@ -99,6 +100,9 @@
 #define EXT4_QUOTA_INIT_BLOCKS(sb) 0
 #define EXT4_QUOTA_DEL_BLOCKS(sb) 0
 #endif
+#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
+#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
+#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
 
 int
 ext4_mark_iloc_dirty(handle_t *handle,
@@ -161,11 +165,13 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
 handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks);
 int __ext4_journal_stop(const char *where, handle_t *handle);
 
-#define EXT4_NOJOURNAL_HANDLE	((handle_t *) 0x1)
+#define EXT4_NOJOURNAL_MAX_REF_COUNT ((unsigned long) 4096)
 
+/* Note:  Do not use this for NULL handles.  This is only to determine if
+ * a properly allocated handle is using a journal or not. */
 static inline int ext4_handle_valid(handle_t *handle)
 {
-	if (handle == EXT4_NOJOURNAL_HANDLE)
+	if ((unsigned long)handle < EXT4_NOJOURNAL_MAX_REF_COUNT)
 		return 0;
 	return 1;
 }
@@ -252,6 +258,19 @@ static inline int ext4_jbd2_file_inode(handle_t *handle, struct inode *inode)
 	return 0;
 }
 
+static inline void ext4_update_inode_fsync_trans(handle_t *handle,
+						 struct inode *inode,
+						 int datasync)
+{
+	struct ext4_inode_info *ei = EXT4_I(inode);
+
+	if (ext4_handle_valid(handle)) {
+		ei->i_sync_tid = handle->h_transaction->t_tid;
+		if (datasync)
+			ei->i_datasync_tid = handle->h_transaction->t_tid;
+	}
+}
+
 /* super.c */
 int ext4_force_commit(struct super_block *sb);
 
fs/ext4/extents.c +446 -47

629 lines not on this page · raw message

fs/ext4/fsync.c +25 -29

79 lines not on this page · raw message

fs/ext4/inode.c +607 -98

1,058 lines not on this page · raw message

fs/ext4/ioctl.c +19 -13
index 7050a9c..b63d193 100644
@@ -221,32 +221,38 @@ setversion_out:
 		struct file *donor_filp;
 		int err;
 
+		if (!(filp->f_mode & FMODE_READ) ||
+		    !(filp->f_mode & FMODE_WRITE))
+			return -EBADF;
+
 		if (copy_from_user(&me,
 			(struct move_extent __user *)arg, sizeof(me)))
 			return -EFAULT;
+		me.moved_len = 0;
 
 		donor_filp = fget(me.donor_fd);
 		if (!donor_filp)
 			return -EBADF;
 
-		if (!capable(CAP_DAC_OVERRIDE)) {
-			if ((current->real_cred->fsuid != inode->i_uid) ||
-				!(inode->i_mode & S_IRUSR) ||
-				!(donor_filp->f_dentry->d_inode->i_mode &
-				S_IRUSR)) {
-				fput(donor_filp);
-				return -EACCES;
-			}
+		if (!(donor_filp->f_mode & FMODE_WRITE)) {
+			err = -EBADF;
+			goto mext_out;
 		}
 
+		err = mnt_want_write(filp->f_path.mnt);
+		if (err)
+			goto mext_out;
+
 		err = ext4_move_extents(filp, donor_filp, me.orig_start,
 					me.donor_start, me.len, &me.moved_len);
-		fput(donor_filp);
+		mnt_drop_write(filp->f_path.mnt);
+		if (me.moved_len > 0)
+			file_remove_suid(donor_filp);
 
-		if (!err)
-			if (copy_to_user((struct move_extent *)arg,
-				&me, sizeof(me)))
-				return -EFAULT;
+		if (copy_to_user((struct move_extent *)arg, &me, sizeof(me)))
+			err = -EFAULT;
+mext_out:
+		fput(donor_filp);
 		return err;
 	}
 
fs/ext4/mballoc.c +169 -153

441 lines not on this page · raw message

fs/ext4/migrate.c +14 -14
index 313a50b..8646149 100644
@@ -75,7 +75,7 @@ static int finish_range(handle_t *handle, struct inode *inode,
 				goto err_out;
 		}
 	}
-	retval = ext4_ext_insert_extent(handle, inode, path, &newext);
+	retval = ext4_ext_insert_extent(handle, inode, path, &newext, 0);
 err_out:
 	if (path) {
 		ext4_ext_drop_refs(path);
@@ -238,7 +238,7 @@ static int extend_credit_for_blkdel(handle_t *handle, struct inode *inode)
 	 * So allocate a credit of 3. We may update
 	 * quota (user and group).
 	 */
-	needed = 3 + 2*EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
+	needed = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
 
 	if (ext4_journal_extend(handle, needed) != 0)
 		retval = ext4_journal_restart(handle, needed);
@@ -353,17 +353,16 @@ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode,
 
 	down_write(&EXT4_I(inode)->i_data_sem);
 	/*
-	 * if EXT4_EXT_MIGRATE is cleared a block allocation
+	 * if EXT4_STATE_EXT_MIGRATE is cleared a block allocation
 	 * happened after we started the migrate. We need to
 	 * fail the migrate
 	 */
-	if (!(EXT4_I(inode)->i_flags & EXT4_EXT_MIGRATE)) {
+	if (!(EXT4_I(inode)->i_state & EXT4_STATE_EXT_MIGRATE)) {
 		retval = -EAGAIN;
 		up_write(&EXT4_I(inode)->i_data_sem);
 		goto err_out;
 	} else
-		EXT4_I(inode)->i_flags = EXT4_I(inode)->i_flags &
-							~EXT4_EXT_MIGRATE;
+		EXT4_I(inode)->i_state &= ~EXT4_STATE_EXT_MIGRATE;
 	/*
 	 * We have the extent map build with the tmp inode.
 	 * Now copy the i_data across
@@ -478,7 +477,7 @@ int ext4_ext_migrate(struct inode *inode)
 	handle = ext4_journal_start(inode,
 					EXT4_DATA_TRANS_BLOCKS(inode->i_sb) +
 					EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
-					2 * EXT4_QUOTA_INIT_BLOCKS(inode->i_sb)
+					EXT4_MAXQUOTAS_INIT_BLOCKS(inode->i_sb)
 					+ 1);
 	if (IS_ERR(handle)) {
 		retval = PTR_ERR(handle);
@@ -517,14 +516,15 @@ int ext4_ext_migrate(struct inode *inode)
 	 * when we add extents we extent the journal
 	 */
 	/*
-	 * Even though we take i_mutex we can still cause block allocation
-	 * via mmap write to holes. If we have allocated new blocks we fail
-	 * migrate.  New block allocation will clear EXT4_EXT_MIGRATE flag.
-	 * The flag is updated with i_data_sem held to prevent racing with
-	 * block allocation.
+	 * Even though we take i_mutex we can still cause block
+	 * allocation via mmap write to holes. If we have allocated
+	 * new blocks we fail migrate.  New block allocation will
+	 * clear EXT4_STATE_EXT_MIGRATE flag.  The flag is updated
+	 * with i_data_sem held to prevent racing with block
+	 * allocation.
 	 */
 	down_read((&EXT4_I(inode)->i_data_sem));
-	EXT4_I(inode)->i_flags = EXT4_I(inode)->i_flags | EXT4_EXT_MIGRATE;
+	EXT4_I(inode)->i_state |= EXT4_STATE_EXT_MIGRATE;
 	up_read((&EXT4_I(inode)->i_data_sem));
 
 	handle = ext4_journal_start(inode, 1);
@@ -618,7 +618,7 @@ err_out:
 	tmp_inode->i_nlink = 0;
 
 	ext4_journal_stop(handle);
-
+	unlock_new_inode(tmp_inode);
 	iput(tmp_inode);
 
 	return retval;
fs/ext4/move_extent.c +335 -237

188 lines not on this page · raw message

fs/ext4/namei.c +21 -26

47 lines not on this page · raw message

fs/ext4/resize.c +1 -1
index 68b0351..96302cd 100644

Lines of this file are not shown. View the raw message.

fs/ext4/super.c +163 -76

239 lines not on this page · raw message

fs/ext4/xattr.c +17 -5
index 62b31c2..0257019 100644

Lines of this file are not shown. View the raw message.

fs/jbd2/commit.c +4 -0
index 7b4088b..8cf902a 100644

Lines of this file are not shown. View the raw message.

fs/jbd2/journal.c +11 -0
index e378cb3..4b74149 100644

Lines of this file are not shown. View the raw message.

fs/jbd2/transaction.c +4 -3
index 6213ac7..a051270 100644

Lines of this file are not shown. View the raw message.

include/linux/sched.h +10 -3
index 0f1ea4a..d3e910b 100644

Lines of this file are not shown. View the raw message.

include/scsi/osd_protocol.h +1 -0
index 2cc8e8b..6856612 100644

Lines of this file are not shown. View the raw message.

include/scsi/scsi_host.h +15 -1
index b62a097..6cc72e2 100644

Lines of this file are not shown. View the raw message.

include/trace/events/ext4.h +52 -8

60 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.