Commit cc28fcdc authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'xfs-4.13-fixes-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Darrick Wong:
 "A handful more bug fixes for you today.

  Changes since last time:

   - Don't leak resources when mount fails

   - Don't accidentally clobber variables when looking for free inodes"

* tag 'xfs-4.13-fixes-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: don't leak quotacheck dquots when cow recovery
  xfs: clear MS_ACTIVE after finishing log recovery
  iomap: fix integer truncation issues in the zeroing and dirtying helpers
  xfs: fix inobt inode allocation search optimization
parents 70bfc741 77aff8c7
...@@ -278,7 +278,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data, ...@@ -278,7 +278,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
unsigned long bytes; /* Bytes to write to page */ unsigned long bytes; /* Bytes to write to page */
offset = (pos & (PAGE_SIZE - 1)); offset = (pos & (PAGE_SIZE - 1));
bytes = min_t(unsigned long, PAGE_SIZE - offset, length); bytes = min_t(loff_t, PAGE_SIZE - offset, length);
rpage = __iomap_read_page(inode, pos); rpage = __iomap_read_page(inode, pos);
if (IS_ERR(rpage)) if (IS_ERR(rpage))
...@@ -373,7 +373,7 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count, ...@@ -373,7 +373,7 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count,
unsigned offset, bytes; unsigned offset, bytes;
offset = pos & (PAGE_SIZE - 1); /* Within page */ offset = pos & (PAGE_SIZE - 1); /* Within page */
bytes = min_t(unsigned, PAGE_SIZE - offset, count); bytes = min_t(loff_t, PAGE_SIZE - offset, count);
if (IS_DAX(inode)) if (IS_DAX(inode))
status = iomap_dax_zero(pos, offset, bytes, iomap); status = iomap_dax_zero(pos, offset, bytes, iomap);
......
...@@ -1246,13 +1246,13 @@ xfs_dialloc_ag_inobt( ...@@ -1246,13 +1246,13 @@ xfs_dialloc_ag_inobt(
/* free inodes to the left? */ /* free inodes to the left? */
if (useleft && trec.ir_freecount) { if (useleft && trec.ir_freecount) {
rec = trec;
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
cur = tcur; cur = tcur;
pag->pagl_leftrec = trec.ir_startino; pag->pagl_leftrec = trec.ir_startino;
pag->pagl_rightrec = rec.ir_startino; pag->pagl_rightrec = rec.ir_startino;
pag->pagl_pagino = pagino; pag->pagl_pagino = pagino;
rec = trec;
goto alloc_inode; goto alloc_inode;
} }
......
...@@ -749,9 +749,20 @@ xfs_log_mount_finish( ...@@ -749,9 +749,20 @@ xfs_log_mount_finish(
return 0; return 0;
} }
/*
* During the second phase of log recovery, we need iget and
* iput to behave like they do for an active filesystem.
* xfs_fs_drop_inode needs to be able to prevent the deletion
* of inodes before we're done replaying log items on those
* inodes. Turn it off immediately after recovery finishes
* so that we don't leak the quota inodes if subsequent mount
* activities fail.
*/
mp->m_super->s_flags |= MS_ACTIVE;
error = xlog_recover_finish(mp->m_log); error = xlog_recover_finish(mp->m_log);
if (!error) if (!error)
xfs_log_work_queue(mp); xfs_log_work_queue(mp);
mp->m_super->s_flags &= ~MS_ACTIVE;
return error; return error;
} }
......
...@@ -944,15 +944,6 @@ xfs_mountfs( ...@@ -944,15 +944,6 @@ xfs_mountfs(
} }
} }
/*
* During the second phase of log recovery, we need iget and
* iput to behave like they do for an active filesystem.
* xfs_fs_drop_inode needs to be able to prevent the deletion
* of inodes before we're done replaying log items on those
* inodes.
*/
mp->m_super->s_flags |= MS_ACTIVE;
/* /*
* Finish recovering the file system. This part needed to be delayed * Finish recovering the file system. This part needed to be delayed
* until after the root and real-time bitmap inodes were consistently * until after the root and real-time bitmap inodes were consistently
...@@ -1028,12 +1019,13 @@ xfs_mountfs( ...@@ -1028,12 +1019,13 @@ xfs_mountfs(
out_quota: out_quota:
xfs_qm_unmount_quotas(mp); xfs_qm_unmount_quotas(mp);
out_rtunmount: out_rtunmount:
mp->m_super->s_flags &= ~MS_ACTIVE;
xfs_rtunmount_inodes(mp); xfs_rtunmount_inodes(mp);
out_rele_rip: out_rele_rip:
IRELE(rip); IRELE(rip);
cancel_delayed_work_sync(&mp->m_reclaim_work); cancel_delayed_work_sync(&mp->m_reclaim_work);
xfs_reclaim_inodes(mp, SYNC_WAIT); xfs_reclaim_inodes(mp, SYNC_WAIT);
/* Clean out dquots that might be in memory after quotacheck. */
xfs_qm_unmount(mp);
out_log_dealloc: out_log_dealloc:
mp->m_flags |= XFS_MOUNT_UNMOUNTING; mp->m_flags |= XFS_MOUNT_UNMOUNTING;
xfs_log_mount_cancel(mp); xfs_log_mount_cancel(mp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment