Message ID | 160031333615.3624373.7775190767495604737.stgit@magnolia (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xfs: fix simple problems with log intent recovery | expand |
On Wed, Sep 16, 2020 at 08:28:56PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@oracle.com> > > In the bmap intent item recovery code, we must be careful to attach the > inode to its dquots (if quotas are enabled) so that a change in the > shape of the bmap btree doesn't cause the quota counters to be > incorrect. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > fs/xfs/xfs_bmap_item.c | 5 +++++ > 1 file changed, 5 insertions(+) > > > diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c > index 815a0563288f..598f713831c9 100644 > --- a/fs/xfs/xfs_bmap_item.c > +++ b/fs/xfs/xfs_bmap_item.c > @@ -24,6 +24,7 @@ > #include "xfs_error.h" > #include "xfs_log_priv.h" > #include "xfs_log_recover.h" > +#include "xfs_quota.h" > > kmem_zone_t *xfs_bui_zone; > kmem_zone_t *xfs_bud_zone; > @@ -498,6 +499,10 @@ xfs_bui_item_recover( > if (error) > goto err_inode; > > + error = xfs_qm_dqattach(ip); > + if (error) > + goto err_inode; Won't this deadlock as the inode is already locked when it is returned by xfs_iget()? Cheers, Dave.
On Thu, Sep 17, 2020 at 02:54:56PM +1000, Dave Chinner wrote: > On Wed, Sep 16, 2020 at 08:28:56PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <darrick.wong@oracle.com> > > > > In the bmap intent item recovery code, we must be careful to attach the > > inode to its dquots (if quotas are enabled) so that a change in the > > shape of the bmap btree doesn't cause the quota counters to be > > incorrect. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > fs/xfs/xfs_bmap_item.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c > > index 815a0563288f..598f713831c9 100644 > > --- a/fs/xfs/xfs_bmap_item.c > > +++ b/fs/xfs/xfs_bmap_item.c > > @@ -24,6 +24,7 @@ > > #include "xfs_error.h" > > #include "xfs_log_priv.h" > > #include "xfs_log_recover.h" > > +#include "xfs_quota.h" > > > > kmem_zone_t *xfs_bui_zone; > > kmem_zone_t *xfs_bud_zone; > > @@ -498,6 +499,10 @@ xfs_bui_item_recover( > > if (error) > > goto err_inode; > > > > + error = xfs_qm_dqattach(ip); > > + if (error) > > + goto err_inode; > > Won't this deadlock as the inode is already locked when it is > returned by xfs_iget()? DOH, yes. The patch "xfs: clean up xfs_bui_item_recover iget/trans_alloc/ilock ordering" obscures that... --D > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com
diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c index 815a0563288f..598f713831c9 100644 --- a/fs/xfs/xfs_bmap_item.c +++ b/fs/xfs/xfs_bmap_item.c @@ -24,6 +24,7 @@ #include "xfs_error.h" #include "xfs_log_priv.h" #include "xfs_log_recover.h" +#include "xfs_quota.h" kmem_zone_t *xfs_bui_zone; kmem_zone_t *xfs_bud_zone; @@ -498,6 +499,10 @@ xfs_bui_item_recover( if (error) goto err_inode; + error = xfs_qm_dqattach(ip); + if (error) + goto err_inode; + if (VFS_I(ip)->i_nlink == 0) xfs_iflags_set(ip, XFS_IRECOVERY);