Skip to content

Commit cc28fcd

Browse files
committed
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
2 parents 70bfc74 + 77aff8c commit cc28fcd

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

fs/iomap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
278278
unsigned long bytes; /* Bytes to write to page */
279279

280280
offset = (pos & (PAGE_SIZE - 1));
281-
bytes = min_t(unsigned long, PAGE_SIZE - offset, length);
281+
bytes = min_t(loff_t, PAGE_SIZE - offset, length);
282282

283283
rpage = __iomap_read_page(inode, pos);
284284
if (IS_ERR(rpage))
@@ -373,7 +373,7 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count,
373373
unsigned offset, bytes;
374374

375375
offset = pos & (PAGE_SIZE - 1); /* Within page */
376-
bytes = min_t(unsigned, PAGE_SIZE - offset, count);
376+
bytes = min_t(loff_t, PAGE_SIZE - offset, count);
377377

378378
if (IS_DAX(inode))
379379
status = iomap_dax_zero(pos, offset, bytes, iomap);

fs/xfs/libxfs/xfs_ialloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,13 +1246,13 @@ xfs_dialloc_ag_inobt(
12461246

12471247
/* free inodes to the left? */
12481248
if (useleft && trec.ir_freecount) {
1249-
rec = trec;
12501249
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
12511250
cur = tcur;
12521251

12531252
pag->pagl_leftrec = trec.ir_startino;
12541253
pag->pagl_rightrec = rec.ir_startino;
12551254
pag->pagl_pagino = pagino;
1255+
rec = trec;
12561256
goto alloc_inode;
12571257
}
12581258

fs/xfs/xfs_log.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,20 @@ xfs_log_mount_finish(
749749
return 0;
750750
}
751751

752+
/*
753+
* During the second phase of log recovery, we need iget and
754+
* iput to behave like they do for an active filesystem.
755+
* xfs_fs_drop_inode needs to be able to prevent the deletion
756+
* of inodes before we're done replaying log items on those
757+
* inodes. Turn it off immediately after recovery finishes
758+
* so that we don't leak the quota inodes if subsequent mount
759+
* activities fail.
760+
*/
761+
mp->m_super->s_flags |= MS_ACTIVE;
752762
error = xlog_recover_finish(mp->m_log);
753763
if (!error)
754764
xfs_log_work_queue(mp);
765+
mp->m_super->s_flags &= ~MS_ACTIVE;
755766

756767
return error;
757768
}

fs/xfs/xfs_mount.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -944,15 +944,6 @@ xfs_mountfs(
944944
}
945945
}
946946

947-
/*
948-
* During the second phase of log recovery, we need iget and
949-
* iput to behave like they do for an active filesystem.
950-
* xfs_fs_drop_inode needs to be able to prevent the deletion
951-
* of inodes before we're done replaying log items on those
952-
* inodes.
953-
*/
954-
mp->m_super->s_flags |= MS_ACTIVE;
955-
956947
/*
957948
* Finish recovering the file system. This part needed to be delayed
958949
* until after the root and real-time bitmap inodes were consistently
@@ -1028,12 +1019,13 @@ xfs_mountfs(
10281019
out_quota:
10291020
xfs_qm_unmount_quotas(mp);
10301021
out_rtunmount:
1031-
mp->m_super->s_flags &= ~MS_ACTIVE;
10321022
xfs_rtunmount_inodes(mp);
10331023
out_rele_rip:
10341024
IRELE(rip);
10351025
cancel_delayed_work_sync(&mp->m_reclaim_work);
10361026
xfs_reclaim_inodes(mp, SYNC_WAIT);
1027+
/* Clean out dquots that might be in memory after quotacheck. */
1028+
xfs_qm_unmount(mp);
10371029
out_log_dealloc:
10381030
mp->m_flags |= XFS_MOUNT_UNMOUNTING;
10391031
xfs_log_mount_cancel(mp);

0 commit comments

Comments
 (0)