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

Commit 369c4f54 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-linus-Jun-21-2012' of git://oss.sgi.com/xfs/xfs

Pull XFS fixes from Ben Myers:
 - Fix stale data exposure with unwritten extents
 - Fix a warning in xfs_alloc_vextent with ODEBUG
 - Fix overallocation and alignment of pages for xfs_bufs
 - Fix a cursor leak
 - Fix a log hang
 - Fix a crash related to xfs_sync_worker
 - Rename xfs log structure from struct log to struct xlog so we can use
   crash dumps effectively

* tag 'for-linus-Jun-21-2012' of git://oss.sgi.com/xfs/xfs:
  xfs: rename log structure to xlog
  xfs: shutdown xfs_sync_worker before the log
  xfs: Fix overallocation in xfs_buf_allocate_memory()
  xfs: fix allocbt cursor leak in xfs_alloc_ag_vextent_near
  xfs: check for stale inode before acquiring iflock on push
  xfs: fix debug_object WARN at xfs_alloc_vextent()
  xfs: xfs_vm_writepage clear iomap_valid when !buffer_uptodate (REV2)
parents a1163719 f7bdf03a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1080,6 +1080,7 @@ xfs_alloc_ag_vextent_near(
			goto restart;
		}

		xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
		trace_xfs_alloc_size_neither(args);
		args->agbno = NULLAGBLOCK;
		return 0;
@@ -2441,7 +2442,7 @@ xfs_alloc_vextent(
	DECLARE_COMPLETION_ONSTACK(done);

	args->done = &done;
	INIT_WORK(&args->work, xfs_alloc_vextent_worker);
	INIT_WORK_ONSTACK(&args->work, xfs_alloc_vextent_worker);
	queue_work(xfs_alloc_wq, &args->work);
	wait_for_completion(&done);
	return args->result;
+8 −3
Original line number Diff line number Diff line
@@ -981,10 +981,15 @@ xfs_vm_writepage(
				imap_valid = 0;
			}
		} else {
			if (PageUptodate(page)) {
			if (PageUptodate(page))
				ASSERT(buffer_mapped(bh));
			/*
			 * This buffer is not uptodate and will not be
			 * written to disk.  Ensure that we will put any
			 * subsequent writeable buffers into a new
			 * ioend.
			 */
			imap_valid = 0;
			}
			continue;
		}

+2 −14
Original line number Diff line number Diff line
@@ -201,14 +201,7 @@ xfs_buf_alloc(
	bp->b_length = numblks;
	bp->b_io_length = numblks;
	bp->b_flags = flags;

	/*
	 * We do not set the block number here in the buffer because we have not
	 * finished initialising the buffer. We insert the buffer into the cache
	 * in this state, so this ensures that we are unable to do IO on a
	 * buffer that hasn't been fully initialised.
	 */
	bp->b_bn = XFS_BUF_DADDR_NULL;
	bp->b_bn = blkno;
	atomic_set(&bp->b_pin_count, 0);
	init_waitqueue_head(&bp->b_waiters);

@@ -567,11 +560,6 @@ xfs_buf_get(
	if (bp != new_bp)
		xfs_buf_free(new_bp);

	/*
	 * Now we have a workable buffer, fill in the block number so
	 * that we can do IO on it.
	 */
	bp->b_bn = blkno;
	bp->b_io_length = bp->b_length;

found:
@@ -772,7 +760,7 @@ xfs_buf_get_uncached(
	int			error, i;
	xfs_buf_t		*bp;

	bp = xfs_buf_alloc(target, 0, numblks, 0);
	bp = xfs_buf_alloc(target, XFS_BUF_DADDR_NULL, numblks, 0);
	if (unlikely(bp == NULL))
		goto fail;

+8 −9
Original line number Diff line number Diff line
@@ -504,6 +504,14 @@ xfs_inode_item_push(
		goto out_unlock;
	}

	/*
	 * Stale inode items should force out the iclog.
	 */
	if (ip->i_flags & XFS_ISTALE) {
		rval = XFS_ITEM_PINNED;
		goto out_unlock;
	}

	/*
	 * Someone else is already flushing the inode.  Nothing we can do
	 * here but wait for the flush to finish and remove the item from
@@ -514,15 +522,6 @@ xfs_inode_item_push(
		goto out_unlock;
	}

	/*
	 * Stale inode items should force out the iclog.
	 */
	if (ip->i_flags & XFS_ISTALE) {
		xfs_ifunlock(ip);
		xfs_iunlock(ip, XFS_ILOCK_SHARED);
		return XFS_ITEM_PINNED;
	}

	ASSERT(iip->ili_fields != 0 || XFS_FORCED_SHUTDOWN(ip->i_mount));
	ASSERT(iip->ili_logged == 0 || XFS_FORCED_SHUTDOWN(ip->i_mount));

+45 −32
Original line number Diff line number Diff line
@@ -38,13 +38,21 @@
kmem_zone_t	*xfs_log_ticket_zone;

/* Local miscellaneous function prototypes */
STATIC int	 xlog_commit_record(struct log *log, struct xlog_ticket *ticket,
				    xlog_in_core_t **, xfs_lsn_t *);
STATIC int
xlog_commit_record(
	struct xlog		*log,
	struct xlog_ticket	*ticket,
	struct xlog_in_core	**iclog,
	xfs_lsn_t		*commitlsnp);

STATIC xlog_t *  xlog_alloc_log(xfs_mount_t	*mp,
				xfs_buftarg_t	*log_target,
				xfs_daddr_t	blk_offset,
				int		num_bblks);
STATIC int	 xlog_space_left(struct log *log, atomic64_t *head);
STATIC int
xlog_space_left(
	struct xlog		*log,
	atomic64_t		*head);
STATIC int	 xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
STATIC void	 xlog_dealloc_log(xlog_t *log);

@@ -64,7 +72,9 @@ STATIC void xlog_state_switch_iclogs(xlog_t *log,
				     int		eventual_size);
STATIC void xlog_state_want_sync(xlog_t	*log, xlog_in_core_t *iclog);

STATIC void xlog_grant_push_ail(struct log	*log,
STATIC void
xlog_grant_push_ail(
	struct xlog	*log,
	int		need_bytes);
STATIC void xlog_regrant_reserve_log_space(xlog_t	 *log,
					   xlog_ticket_t *ticket);
@@ -73,7 +83,9 @@ STATIC void xlog_ungrant_log_space(xlog_t *log,

#if defined(DEBUG)
STATIC void	xlog_verify_dest_ptr(xlog_t *log, char *ptr);
STATIC void	xlog_verify_grant_tail(struct log *log);
STATIC void
xlog_verify_grant_tail(
	struct xlog	*log);
STATIC void	xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog,
				  int count, boolean_t syncing);
STATIC void	xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
@@ -89,7 +101,7 @@ STATIC int xlog_iclogs_empty(xlog_t *log);

static void
xlog_grant_sub_space(
	struct log	*log,
	struct xlog		*log,
	atomic64_t		*head,
	int			bytes)
{
@@ -115,7 +127,7 @@ xlog_grant_sub_space(

static void
xlog_grant_add_space(
	struct log	*log,
	struct xlog		*log,
	atomic64_t		*head,
	int			bytes)
{
@@ -165,7 +177,7 @@ xlog_grant_head_wake_all(

static inline int
xlog_ticket_reservation(
	struct log		*log,
	struct xlog		*log,
	struct xlog_grant_head	*head,
	struct xlog_ticket	*tic)
{
@@ -182,7 +194,7 @@ xlog_ticket_reservation(

STATIC bool
xlog_grant_head_wake(
	struct log		*log,
	struct xlog		*log,
	struct xlog_grant_head	*head,
	int			*free_bytes)
{
@@ -204,7 +216,7 @@ xlog_grant_head_wake(

STATIC int
xlog_grant_head_wait(
	struct log		*log,
	struct xlog		*log,
	struct xlog_grant_head	*head,
	struct xlog_ticket	*tic,
	int			need_bytes)
@@ -256,7 +268,7 @@ xlog_grant_head_wait(
 */
STATIC int
xlog_grant_head_check(
	struct log		*log,
	struct xlog		*log,
	struct xlog_grant_head	*head,
	struct xlog_ticket	*tic,
	int			*need_bytes)
@@ -323,7 +335,7 @@ xfs_log_regrant(
	struct xfs_mount	*mp,
	struct xlog_ticket	*tic)
{
	struct log		*log = mp->m_log;
	struct xlog		*log = mp->m_log;
	int			need_bytes;
	int			error = 0;

@@ -389,7 +401,7 @@ xfs_log_reserve(
	bool			permanent,
	uint		 	t_type)
{
	struct log		*log = mp->m_log;
	struct xlog		*log = mp->m_log;
	struct xlog_ticket	*tic;
	int			need_bytes;
	int			error = 0;
@@ -465,7 +477,7 @@ xfs_log_done(
	struct xlog_in_core	**iclog,
	uint			flags)
{
	struct log		*log = mp->m_log;
	struct xlog		*log = mp->m_log;
	xfs_lsn_t		lsn = 0;

	if (XLOG_FORCED_SHUTDOWN(log) ||
@@ -810,6 +822,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
void
xfs_log_unmount(xfs_mount_t *mp)
{
	cancel_delayed_work_sync(&mp->m_sync_work);
	xfs_trans_ail_destroy(mp);
	xlog_dealloc_log(mp->m_log);
}
@@ -838,7 +851,7 @@ void
xfs_log_space_wake(
	struct xfs_mount	*mp)
{
	struct log		*log = mp->m_log;
	struct xlog		*log = mp->m_log;
	int			free_bytes;

	if (XLOG_FORCED_SHUTDOWN(log))
@@ -916,7 +929,7 @@ xfs_lsn_t
xlog_assign_tail_lsn_locked(
	struct xfs_mount	*mp)
{
	struct log		*log = mp->m_log;
	struct xlog		*log = mp->m_log;
	struct xfs_log_item	*lip;
	xfs_lsn_t		tail_lsn;

@@ -965,7 +978,7 @@ xlog_assign_tail_lsn(
 */
STATIC int
xlog_space_left(
	struct log	*log,
	struct xlog	*log,
	atomic64_t	*head)
{
	int		free_bytes;
@@ -1277,7 +1290,7 @@ xlog_alloc_log(xfs_mount_t *mp,
 */
STATIC int
xlog_commit_record(
	struct log		*log,
	struct xlog		*log,
	struct xlog_ticket	*ticket,
	struct xlog_in_core	**iclog,
	xfs_lsn_t		*commitlsnp)
@@ -1311,7 +1324,7 @@ xlog_commit_record(
 */
STATIC void
xlog_grant_push_ail(
	struct log	*log,
	struct xlog	*log,
	int		need_bytes)
{
	xfs_lsn_t	threshold_lsn = 0;
@@ -1790,7 +1803,7 @@ xlog_write_start_rec(

static xlog_op_header_t *
xlog_write_setup_ophdr(
	struct log		*log,
	struct xlog		*log,
	struct xlog_op_header	*ophdr,
	struct xlog_ticket	*ticket,
	uint			flags)
@@ -1873,7 +1886,7 @@ xlog_write_setup_copy(

static int
xlog_write_copy_finish(
	struct log		*log,
	struct xlog		*log,
	struct xlog_in_core	*iclog,
	uint			flags,
	int			*record_cnt,
@@ -1958,7 +1971,7 @@ xlog_write_copy_finish(
 */
int
xlog_write(
	struct log		*log,
	struct xlog		*log,
	struct xfs_log_vec	*log_vector,
	struct xlog_ticket	*ticket,
	xfs_lsn_t		*start_lsn,
@@ -2821,7 +2834,7 @@ _xfs_log_force(
	uint			flags,
	int			*log_flushed)
{
	struct log		*log = mp->m_log;
	struct xlog		*log = mp->m_log;
	struct xlog_in_core	*iclog;
	xfs_lsn_t		lsn;

@@ -2969,7 +2982,7 @@ _xfs_log_force_lsn(
	uint			flags,
	int			*log_flushed)
{
	struct log		*log = mp->m_log;
	struct xlog		*log = mp->m_log;
	struct xlog_in_core	*iclog;
	int			already_slept = 0;

@@ -3147,7 +3160,7 @@ xfs_log_ticket_get(
 */
xlog_ticket_t *
xlog_ticket_alloc(
	struct log	*log,
	struct xlog	*log,
	int		unit_bytes,
	int		cnt,
	char		client,
@@ -3278,7 +3291,7 @@ xlog_ticket_alloc(
 */
void
xlog_verify_dest_ptr(
	struct log	*log,
	struct xlog	*log,
	char		*ptr)
{
	int i;
@@ -3307,7 +3320,7 @@ xlog_verify_dest_ptr(
 */
STATIC void
xlog_verify_grant_tail(
	struct log	*log)
	struct xlog	*log)
{
	int		tail_cycle, tail_blocks;
	int		cycle, space;
Loading