diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-05-08 20:41:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-05-08 20:41:05 -0400 |
commit | e515f048c46e457ef61ce9c8b56bd36e825a48a0 (patch) | |
tree | fc1598f464fa4933c3245619b7a7bbb69fe4649e | |
parent | 601e7f024edbea8018de34c83a7398623214e636 (diff) | |
parent | e63a3690013a475746ad2cea998ebb534d825704 (diff) |
Merge git://oss.sgi.com:8090/xfs-2.6
* 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
-rw-r--r-- | fs/xfs/xfs_alloc.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_rename.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_vfsops.c | 27 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 2 |
4 files changed, 26 insertions, 20 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index 64ee07db0d5e..8558226281c4 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -1942,8 +1942,10 @@ xfs_alloc_fix_freelist( | |||
1942 | /* | 1942 | /* |
1943 | * Allocate as many blocks as possible at once. | 1943 | * Allocate as many blocks as possible at once. |
1944 | */ | 1944 | */ |
1945 | if ((error = xfs_alloc_ag_vextent(&targs))) | 1945 | if ((error = xfs_alloc_ag_vextent(&targs))) { |
1946 | xfs_trans_brelse(tp, agflbp); | ||
1946 | return error; | 1947 | return error; |
1948 | } | ||
1947 | /* | 1949 | /* |
1948 | * Stop if we run out. Won't happen if callers are obeying | 1950 | * Stop if we run out. Won't happen if callers are obeying |
1949 | * the restrictions correctly. Can happen for free calls | 1951 | * the restrictions correctly. Can happen for free calls |
@@ -1960,6 +1962,7 @@ xfs_alloc_fix_freelist( | |||
1960 | return error; | 1962 | return error; |
1961 | } | 1963 | } |
1962 | } | 1964 | } |
1965 | xfs_trans_brelse(tp, agflbp); | ||
1963 | args->agbp = agbp; | 1966 | args->agbp = agbp; |
1964 | return 0; | 1967 | return 0; |
1965 | } | 1968 | } |
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index 81a05cfd77d2..1f148762eb28 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
@@ -316,6 +316,18 @@ xfs_rename( | |||
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
319 | /* | ||
320 | * If we are using project inheritance, we only allow renames | ||
321 | * into our tree when the project IDs are the same; else the | ||
322 | * tree quota mechanism would be circumvented. | ||
323 | */ | ||
324 | if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && | ||
325 | (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) { | ||
326 | error = XFS_ERROR(EXDEV); | ||
327 | xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED); | ||
328 | goto rele_return; | ||
329 | } | ||
330 | |||
319 | new_parent = (src_dp != target_dp); | 331 | new_parent = (src_dp != target_dp); |
320 | src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); | 332 | src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); |
321 | 333 | ||
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index f0e09ca14139..36ea1b2094f2 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -669,31 +669,22 @@ xfs_mntupdate( | |||
669 | xfs_mount_t *mp = XFS_BHVTOM(bdp); | 669 | xfs_mount_t *mp = XFS_BHVTOM(bdp); |
670 | int error; | 670 | int error; |
671 | 671 | ||
672 | if (args->flags & XFSMNT_BARRIER) | 672 | if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */ |
673 | mp->m_flags |= XFS_MOUNT_BARRIER; | 673 | if (vfsp->vfs_flag & VFS_RDONLY) |
674 | else | 674 | vfsp->vfs_flag &= ~VFS_RDONLY; |
675 | mp->m_flags &= ~XFS_MOUNT_BARRIER; | 675 | if (args->flags & XFSMNT_BARRIER) { |
676 | 676 | mp->m_flags |= XFS_MOUNT_BARRIER; | |
677 | if ((vfsp->vfs_flag & VFS_RDONLY) && | ||
678 | !(*flags & MS_RDONLY)) { | ||
679 | vfsp->vfs_flag &= ~VFS_RDONLY; | ||
680 | |||
681 | if (args->flags & XFSMNT_BARRIER) | ||
682 | xfs_mountfs_check_barriers(mp); | 677 | xfs_mountfs_check_barriers(mp); |
683 | } | 678 | } else { |
684 | 679 | mp->m_flags &= ~XFS_MOUNT_BARRIER; | |
685 | if (!(vfsp->vfs_flag & VFS_RDONLY) && | 680 | } |
686 | (*flags & MS_RDONLY)) { | 681 | } else if (!(vfsp->vfs_flag & VFS_RDONLY)) { /* rw -> ro */ |
687 | VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error); | 682 | VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error); |
688 | |||
689 | xfs_quiesce_fs(mp); | 683 | xfs_quiesce_fs(mp); |
690 | |||
691 | /* Ok now write out an unmount record */ | ||
692 | xfs_log_unmount_write(mp); | 684 | xfs_log_unmount_write(mp); |
693 | xfs_unmountfs_writesb(mp); | 685 | xfs_unmountfs_writesb(mp); |
694 | vfsp->vfs_flag |= VFS_RDONLY; | 686 | vfsp->vfs_flag |= VFS_RDONLY; |
695 | } | 687 | } |
696 | |||
697 | return 0; | 688 | return 0; |
698 | } | 689 | } |
699 | 690 | ||
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index fa71b305ba5c..7027ae68ee38 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -2663,7 +2663,7 @@ xfs_link( | |||
2663 | */ | 2663 | */ |
2664 | if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && | 2664 | if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && |
2665 | (tdp->i_d.di_projid != sip->i_d.di_projid))) { | 2665 | (tdp->i_d.di_projid != sip->i_d.di_projid))) { |
2666 | error = XFS_ERROR(EPERM); | 2666 | error = XFS_ERROR(EXDEV); |
2667 | goto error_return; | 2667 | goto error_return; |
2668 | } | 2668 | } |
2669 | 2669 | ||