aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_inode_fork.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-04-10 17:40:42 -0400
committerDave Airlie <airlied@redhat.com>2017-04-10 17:40:42 -0400
commitb769fefb68cd70385d68220ae341e5a10723fbc0 (patch)
treea2881410c9dc5a3474619d155fac981cfbd4ee8f /fs/xfs/libxfs/xfs_inode_fork.c
parent1420f63b8207e966f54caec26d08abdc2ff37193 (diff)
parent39da7c509acff13fc8cb12ec1bb20337c988ed36 (diff)
Backmerge tag 'v4.11-rc6' into drm-next
Linux 4.11-rc6 drm-misc needs 4.11-rc5, may as well fix conflicts with rc6.
Diffstat (limited to 'fs/xfs/libxfs/xfs_inode_fork.c')
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index 9653e964eda4..8a37efe04de3 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -212,6 +212,16 @@ xfs_iformat_fork(
212 if (error) 212 if (error)
213 return error; 213 return error;
214 214
215 /* Check inline dir contents. */
216 if (S_ISDIR(VFS_I(ip)->i_mode) &&
217 dip->di_format == XFS_DINODE_FMT_LOCAL) {
218 error = xfs_dir2_sf_verify(ip);
219 if (error) {
220 xfs_idestroy_fork(ip, XFS_DATA_FORK);
221 return error;
222 }
223 }
224
215 if (xfs_is_reflink_inode(ip)) { 225 if (xfs_is_reflink_inode(ip)) {
216 ASSERT(ip->i_cowfp == NULL); 226 ASSERT(ip->i_cowfp == NULL);
217 xfs_ifork_init_cow(ip); 227 xfs_ifork_init_cow(ip);
@@ -322,8 +332,6 @@ xfs_iformat_local(
322 int whichfork, 332 int whichfork,
323 int size) 333 int size)
324{ 334{
325 int error;
326
327 /* 335 /*
328 * If the size is unreasonable, then something 336 * If the size is unreasonable, then something
329 * is wrong and we just bail out rather than crash in 337 * is wrong and we just bail out rather than crash in
@@ -339,14 +347,6 @@ xfs_iformat_local(
339 return -EFSCORRUPTED; 347 return -EFSCORRUPTED;
340 } 348 }
341 349
342 if (S_ISDIR(VFS_I(ip)->i_mode) && whichfork == XFS_DATA_FORK) {
343 error = xfs_dir2_sf_verify(ip->i_mount,
344 (struct xfs_dir2_sf_hdr *)XFS_DFORK_DPTR(dip),
345 size);
346 if (error)
347 return error;
348 }
349
350 xfs_init_local_fork(ip, whichfork, XFS_DFORK_PTR(dip, whichfork), size); 350 xfs_init_local_fork(ip, whichfork, XFS_DFORK_PTR(dip, whichfork), size);
351 return 0; 351 return 0;
352} 352}
@@ -867,7 +867,7 @@ xfs_iextents_copy(
867 * In these cases, the format always takes precedence, because the 867 * In these cases, the format always takes precedence, because the
868 * format indicates the current state of the fork. 868 * format indicates the current state of the fork.
869 */ 869 */
870int 870void
871xfs_iflush_fork( 871xfs_iflush_fork(
872 xfs_inode_t *ip, 872 xfs_inode_t *ip,
873 xfs_dinode_t *dip, 873 xfs_dinode_t *dip,
@@ -877,7 +877,6 @@ xfs_iflush_fork(
877 char *cp; 877 char *cp;
878 xfs_ifork_t *ifp; 878 xfs_ifork_t *ifp;
879 xfs_mount_t *mp; 879 xfs_mount_t *mp;
880 int error;
881 static const short brootflag[2] = 880 static const short brootflag[2] =
882 { XFS_ILOG_DBROOT, XFS_ILOG_ABROOT }; 881 { XFS_ILOG_DBROOT, XFS_ILOG_ABROOT };
883 static const short dataflag[2] = 882 static const short dataflag[2] =
@@ -886,7 +885,7 @@ xfs_iflush_fork(
886 { XFS_ILOG_DEXT, XFS_ILOG_AEXT }; 885 { XFS_ILOG_DEXT, XFS_ILOG_AEXT };
887 886
888 if (!iip) 887 if (!iip)
889 return 0; 888 return;
890 ifp = XFS_IFORK_PTR(ip, whichfork); 889 ifp = XFS_IFORK_PTR(ip, whichfork);
891 /* 890 /*
892 * This can happen if we gave up in iformat in an error path, 891 * This can happen if we gave up in iformat in an error path,
@@ -894,19 +893,12 @@ xfs_iflush_fork(
894 */ 893 */
895 if (!ifp) { 894 if (!ifp) {
896 ASSERT(whichfork == XFS_ATTR_FORK); 895 ASSERT(whichfork == XFS_ATTR_FORK);
897 return 0; 896 return;
898 } 897 }
899 cp = XFS_DFORK_PTR(dip, whichfork); 898 cp = XFS_DFORK_PTR(dip, whichfork);
900 mp = ip->i_mount; 899 mp = ip->i_mount;
901 switch (XFS_IFORK_FORMAT(ip, whichfork)) { 900 switch (XFS_IFORK_FORMAT(ip, whichfork)) {
902 case XFS_DINODE_FMT_LOCAL: 901 case XFS_DINODE_FMT_LOCAL:
903 if (S_ISDIR(VFS_I(ip)->i_mode) && whichfork == XFS_DATA_FORK) {
904 error = xfs_dir2_sf_verify(mp,
905 (struct xfs_dir2_sf_hdr *)ifp->if_u1.if_data,
906 ifp->if_bytes);
907 if (error)
908 return error;
909 }
910 if ((iip->ili_fields & dataflag[whichfork]) && 902 if ((iip->ili_fields & dataflag[whichfork]) &&
911 (ifp->if_bytes > 0)) { 903 (ifp->if_bytes > 0)) {
912 ASSERT(ifp->if_u1.if_data != NULL); 904 ASSERT(ifp->if_u1.if_data != NULL);
@@ -959,7 +951,6 @@ xfs_iflush_fork(
959 ASSERT(0); 951 ASSERT(0);
960 break; 952 break;
961 } 953 }
962 return 0;
963} 954}
964 955
965/* 956/*