patch-2.4.7 linux/fs/sysv/ialloc.c
Next file: linux/fs/sysv/inode.c
Previous file: linux/fs/sysv/dir.c
Back to the patch index
Back to the overall index
- Lines: 45
- Date:
Tue Jul 17 18:53:55 2001
- Orig file:
v2.4.6/linux/fs/sysv/ialloc.c
- Orig date:
Tue Jul 3 17:08:21 2001
diff -u --recursive --new-file v2.4.6/linux/fs/sysv/ialloc.c linux/fs/sysv/ialloc.c
@@ -136,7 +136,8 @@
sb = dir->i_sb;
inode = new_inode(sb);
if (!inode)
- return NULL;
+ return ERR_PTR(-ENOMEM);
+
lock_super(sb);
count = fs16_to_cpu(sb, *sb->sv_sb_fic_count);
if (count == 0 || (*sv_sb_fic_inode(sb,count-1) == 0)) {
@@ -144,7 +145,7 @@
if (count == 0) {
iput(inode);
unlock_super(sb);
- return NULL;
+ return ERR_PTR(-ENOSPC);
}
}
/* Now count > 0. */
@@ -152,16 +153,23 @@
*sb->sv_sb_fic_count = cpu_to_fs16(sb, count);
fs16_add(sb, sb->sv_sb_total_free_inodes, -1);
dirty_sb(sb);
+
+ if (dir->i_mode & S_ISGID) {
+ inode->i_gid = dir->i_gid;
+ if (S_ISDIR(mode))
+ mode |= S_ISGID;
+ } else
+ inode->i_gid = current->fsgid;
+
inode->i_uid = current->fsuid;
- inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
inode->i_ino = fs16_to_cpu(sb, ino);
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_blocks = inode->i_blksize = 0;
insert_inode_hash(inode);
mark_inode_dirty(inode);
+
inode->i_mode = mode; /* for sysv_write_inode() */
sysv_write_inode(inode, 0); /* ensure inode not allocated again */
- /* FIXME: caller may call this too. */
mark_inode_dirty(inode); /* cleared by sysv_write_inode() */
/* That's it. */
unlock_super(sb);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)