diff options
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 2ef100be6c4f..59829523ab07 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1078,6 +1078,11 @@ xfs_iread_extents( | |||
1078 | * also returns the [locked] bp pointing to the head of the freelist | 1078 | * also returns the [locked] bp pointing to the head of the freelist |
1079 | * as ialloc_context. The caller should hold this buffer across | 1079 | * as ialloc_context. The caller should hold this buffer across |
1080 | * the commit and pass it back into this routine on the second call. | 1080 | * the commit and pass it back into this routine on the second call. |
1081 | * | ||
1082 | * If we are allocating quota inodes, we do not have a parent inode | ||
1083 | * to attach to or associate with (i.e. pip == NULL) because they | ||
1084 | * are not linked into the directory structure - they are attached | ||
1085 | * directly to the superblock - and so have no parent. | ||
1081 | */ | 1086 | */ |
1082 | int | 1087 | int |
1083 | xfs_ialloc( | 1088 | xfs_ialloc( |
@@ -1103,7 +1108,7 @@ xfs_ialloc( | |||
1103 | * Call the space management code to pick | 1108 | * Call the space management code to pick |
1104 | * the on-disk inode to be allocated. | 1109 | * the on-disk inode to be allocated. |
1105 | */ | 1110 | */ |
1106 | error = xfs_dialloc(tp, pip->i_ino, mode, okalloc, | 1111 | error = xfs_dialloc(tp, pip ? pip->i_ino : 0, mode, okalloc, |
1107 | ialloc_context, call_again, &ino); | 1112 | ialloc_context, call_again, &ino); |
1108 | if (error != 0) { | 1113 | if (error != 0) { |
1109 | return error; | 1114 | return error; |
@@ -1157,7 +1162,7 @@ xfs_ialloc( | |||
1157 | if ((prid != 0) && (ip->i_d.di_version == XFS_DINODE_VERSION_1)) | 1162 | if ((prid != 0) && (ip->i_d.di_version == XFS_DINODE_VERSION_1)) |
1158 | xfs_bump_ino_vers2(tp, ip); | 1163 | xfs_bump_ino_vers2(tp, ip); |
1159 | 1164 | ||
1160 | if (XFS_INHERIT_GID(pip, vp->v_vfsp)) { | 1165 | if (pip && XFS_INHERIT_GID(pip, vp->v_vfsp)) { |
1161 | ip->i_d.di_gid = pip->i_d.di_gid; | 1166 | ip->i_d.di_gid = pip->i_d.di_gid; |
1162 | if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) { | 1167 | if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) { |
1163 | ip->i_d.di_mode |= S_ISGID; | 1168 | ip->i_d.di_mode |= S_ISGID; |
@@ -1199,7 +1204,7 @@ xfs_ialloc( | |||
1199 | flags |= XFS_ILOG_DEV; | 1204 | flags |= XFS_ILOG_DEV; |
1200 | break; | 1205 | break; |
1201 | case S_IFREG: | 1206 | case S_IFREG: |
1202 | if (xfs_inode_is_filestream(pip)) { | 1207 | if (pip && xfs_inode_is_filestream(pip)) { |
1203 | error = xfs_filestream_associate(pip, ip); | 1208 | error = xfs_filestream_associate(pip, ip); |
1204 | if (error < 0) | 1209 | if (error < 0) |
1205 | return -error; | 1210 | return -error; |
@@ -1208,7 +1213,7 @@ xfs_ialloc( | |||
1208 | } | 1213 | } |
1209 | /* fall through */ | 1214 | /* fall through */ |
1210 | case S_IFDIR: | 1215 | case S_IFDIR: |
1211 | if (pip->i_d.di_flags & XFS_DIFLAG_ANY) { | 1216 | if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { |
1212 | uint di_flags = 0; | 1217 | uint di_flags = 0; |
1213 | 1218 | ||
1214 | if ((mode & S_IFMT) == S_IFDIR) { | 1219 | if ((mode & S_IFMT) == S_IFDIR) { |