Skip to content

Commit

Permalink
Merge git://oss.sgi.com:8090/xfs-2.6
Browse files Browse the repository at this point in the history
* git://oss.sgi.com:8090/xfs-2.6:
  [XFS] Fix a possible metadata buffer (AGFL) refcount leak when fixing an
  [XFS] Fix a project quota space accounting leak on rename.
  [XFS] Fix a possible forced shutdown due to mishandling write barriers
  • Loading branch information
Linus Torvalds committed May 9, 2006
2 parents 601e7f0 + e63a369 commit e515f04
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
5 changes: 4 additions & 1 deletion fs/xfs/xfs_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1942,8 +1942,10 @@ xfs_alloc_fix_freelist(
/*
* Allocate as many blocks as possible at once.
*/
if ((error = xfs_alloc_ag_vextent(&targs)))
if ((error = xfs_alloc_ag_vextent(&targs))) {
xfs_trans_brelse(tp, agflbp);
return error;
}
/*
* Stop if we run out. Won't happen if callers are obeying
* the restrictions correctly. Can happen for free calls
Expand All @@ -1960,6 +1962,7 @@ xfs_alloc_fix_freelist(
return error;
}
}
xfs_trans_brelse(tp, agflbp);
args->agbp = agbp;
return 0;
}
Expand Down
12 changes: 12 additions & 0 deletions fs/xfs/xfs_rename.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,18 @@ xfs_rename(
}
}

/*
* If we are using project inheritance, we only allow renames
* into our tree when the project IDs are the same; else the
* tree quota mechanism would be circumvented.
*/
if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
(target_dp->i_d.di_projid != src_ip->i_d.di_projid))) {
error = XFS_ERROR(EXDEV);
xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
goto rele_return;
}

new_parent = (src_dp != target_dp);
src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR);

Expand Down
27 changes: 9 additions & 18 deletions fs/xfs/xfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,31 +669,22 @@ xfs_mntupdate(
xfs_mount_t *mp = XFS_BHVTOM(bdp);
int error;

if (args->flags & XFSMNT_BARRIER)
mp->m_flags |= XFS_MOUNT_BARRIER;
else
mp->m_flags &= ~XFS_MOUNT_BARRIER;

if ((vfsp->vfs_flag & VFS_RDONLY) &&
!(*flags & MS_RDONLY)) {
vfsp->vfs_flag &= ~VFS_RDONLY;

if (args->flags & XFSMNT_BARRIER)
if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */
if (vfsp->vfs_flag & VFS_RDONLY)
vfsp->vfs_flag &= ~VFS_RDONLY;
if (args->flags & XFSMNT_BARRIER) {
mp->m_flags |= XFS_MOUNT_BARRIER;
xfs_mountfs_check_barriers(mp);
}

if (!(vfsp->vfs_flag & VFS_RDONLY) &&
(*flags & MS_RDONLY)) {
} else {
mp->m_flags &= ~XFS_MOUNT_BARRIER;
}
} else if (!(vfsp->vfs_flag & VFS_RDONLY)) { /* rw -> ro */
VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error);

xfs_quiesce_fs(mp);

/* Ok now write out an unmount record */
xfs_log_unmount_write(mp);
xfs_unmountfs_writesb(mp);
vfsp->vfs_flag |= VFS_RDONLY;
}

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_vnodeops.c
Original file line number Diff line number Diff line change
Expand Up @@ -2663,7 +2663,7 @@ xfs_link(
*/
if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
(tdp->i_d.di_projid != sip->i_d.di_projid))) {
error = XFS_ERROR(EPERM);
error = XFS_ERROR(EXDEV);
goto error_return;
}

Expand Down

0 comments on commit e515f04

Please sign in to comment.