aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAkinobu Mita <mita@miraclelinux.com>2006-09-14 10:22:38 -0400
committerDave Kleikamp <shaggy@austin.ibm.com>2006-10-02 10:51:01 -0400
commit087387f90f577f5a0ab68d33ef326c9bb6d80dda (patch)
tree99f2ba6f672c9d98fbd628ee54120f63593f1bd0 /fs
parent2a6968a9784551c216f9379a728d4104dbad98a8 (diff)
[PATCH] JFS: return correct error when i-node allocation failed
I have seen confusing behavior on JFS when I injected many intentional slab allocation errors. The cp command failed with no disk space error with enough disk space. This patch makes: - change the return value in case slab allocation failures happen from -ENOSPC to -ENOMEM - ialloc() return error code so that the caller can know the reason of failures Signed-off-by: Akinobu Mita <mita@miraclelinux.com> Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> (cherry picked from 2b46f77976f798f3fe800809a1d0ed38763c71c8 commit)
Diffstat (limited to 'fs')
-rw-r--r--fs/jfs/jfs_dtree.c4
-rw-r--r--fs/jfs/jfs_inode.c9
-rw-r--r--fs/jfs/jfs_unicode.c2
-rw-r--r--fs/jfs/namei.c17
-rw-r--r--fs/jfs/super.c2
5 files changed, 17 insertions, 17 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index 6c3f08319846..a9f2604f28cf 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -3780,13 +3780,13 @@ static int ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp,
3780 lkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), 3780 lkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t),
3781 GFP_KERNEL); 3781 GFP_KERNEL);
3782 if (lkey.name == NULL) 3782 if (lkey.name == NULL)
3783 return -ENOSPC; 3783 return -ENOMEM;
3784 3784
3785 rkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), 3785 rkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t),
3786 GFP_KERNEL); 3786 GFP_KERNEL);
3787 if (rkey.name == NULL) { 3787 if (rkey.name == NULL) {
3788 kfree(lkey.name); 3788 kfree(lkey.name);
3789 return -ENOSPC; 3789 return -ENOMEM;
3790 } 3790 }
3791 3791
3792 /* get left and right key */ 3792 /* get left and right key */
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index bffaca9ae3a2..dbf0f77c7a4a 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -61,7 +61,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
61 inode = new_inode(sb); 61 inode = new_inode(sb);
62 if (!inode) { 62 if (!inode) {
63 jfs_warn("ialloc: new_inode returned NULL!"); 63 jfs_warn("ialloc: new_inode returned NULL!");
64 return inode; 64 return ERR_PTR(-ENOMEM);
65 } 65 }
66 66
67 jfs_inode = JFS_IP(inode); 67 jfs_inode = JFS_IP(inode);
@@ -69,9 +69,10 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
69 rc = diAlloc(parent, S_ISDIR(mode), inode); 69 rc = diAlloc(parent, S_ISDIR(mode), inode);
70 if (rc) { 70 if (rc) {
71 jfs_warn("ialloc: diAlloc returned %d!", rc); 71 jfs_warn("ialloc: diAlloc returned %d!", rc);
72 make_bad_inode(inode); 72 if (rc == -EIO)
73 make_bad_inode(inode);
73 iput(inode); 74 iput(inode);
74 return NULL; 75 return ERR_PTR(rc);
75 } 76 }
76 77
77 inode->i_uid = current->fsuid; 78 inode->i_uid = current->fsuid;
@@ -97,7 +98,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
97 inode->i_flags |= S_NOQUOTA; 98 inode->i_flags |= S_NOQUOTA;
98 inode->i_nlink = 0; 99 inode->i_nlink = 0;
99 iput(inode); 100 iput(inode);
100 return NULL; 101 return ERR_PTR(-EDQUOT);
101 } 102 }
102 103
103 inode->i_mode = mode; 104 inode->i_mode = mode;
diff --git a/fs/jfs/jfs_unicode.c b/fs/jfs/jfs_unicode.c
index f327decfb155..0543f7fd4364 100644
--- a/fs/jfs/jfs_unicode.c
+++ b/fs/jfs/jfs_unicode.c
@@ -124,7 +124,7 @@ int get_UCSname(struct component_name * uniName, struct dentry *dentry)
124 kmalloc((length + 1) * sizeof(wchar_t), GFP_NOFS); 124 kmalloc((length + 1) * sizeof(wchar_t), GFP_NOFS);
125 125
126 if (uniName->name == NULL) 126 if (uniName->name == NULL)
127 return -ENOSPC; 127 return -ENOMEM;
128 128
129 uniName->namlen = jfs_strtoUCS(uniName->name, dentry->d_name.name, 129 uniName->namlen = jfs_strtoUCS(uniName->name, dentry->d_name.name,
130 length, nls_tab); 130 length, nls_tab);
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index b8d16a6aa88f..5d4ef6e4b7e9 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -97,8 +97,8 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
97 * begin the transaction before we search the directory. 97 * begin the transaction before we search the directory.
98 */ 98 */
99 ip = ialloc(dip, mode); 99 ip = ialloc(dip, mode);
100 if (ip == NULL) { 100 if (IS_ERR(ip)) {
101 rc = -ENOSPC; 101 rc = PTR_ERR(ip);
102 goto out2; 102 goto out2;
103 } 103 }
104 104
@@ -231,8 +231,8 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
231 * begin the transaction before we search the directory. 231 * begin the transaction before we search the directory.
232 */ 232 */
233 ip = ialloc(dip, S_IFDIR | mode); 233 ip = ialloc(dip, S_IFDIR | mode);
234 if (ip == NULL) { 234 if (IS_ERR(ip)) {
235 rc = -ENOSPC; 235 rc = PTR_ERR(ip);
236 goto out2; 236 goto out2;
237 } 237 }
238 238
@@ -906,8 +906,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
906 * (iAlloc() returns new, locked inode) 906 * (iAlloc() returns new, locked inode)
907 */ 907 */
908 ip = ialloc(dip, S_IFLNK | 0777); 908 ip = ialloc(dip, S_IFLNK | 0777);
909 if (ip == NULL) { 909 if (IS_ERR(ip)) {
910 rc = -ENOSPC; 910 rc = PTR_ERR(ip);
911 goto out2; 911 goto out2;
912 } 912 }
913 913
@@ -978,7 +978,6 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
978 xlen = xsize >> JFS_SBI(sb)->l2bsize; 978 xlen = xsize >> JFS_SBI(sb)->l2bsize;
979 if ((rc = xtInsert(tid, ip, 0, 0, xlen, &xaddr, 0))) { 979 if ((rc = xtInsert(tid, ip, 0, 0, xlen, &xaddr, 0))) {
980 txAbort(tid, 0); 980 txAbort(tid, 0);
981 rc = -ENOSPC;
982 goto out3; 981 goto out3;
983 } 982 }
984 extent = xaddr; 983 extent = xaddr;
@@ -1350,8 +1349,8 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1350 goto out; 1349 goto out;
1351 1350
1352 ip = ialloc(dir, mode); 1351 ip = ialloc(dir, mode);
1353 if (ip == NULL) { 1352 if (IS_ERR(ip)) {
1354 rc = -ENOSPC; 1353 rc = PTR_ERR(ip);
1355 goto out1; 1354 goto out1;
1356 } 1355 }
1357 jfs_ip = JFS_IP(ip); 1356 jfs_ip = JFS_IP(ip);
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 143bcd1d5eaa..fc6951587c6b 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -422,7 +422,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
422 422
423 sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); 423 sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL);
424 if (!sbi) 424 if (!sbi)
425 return -ENOSPC; 425 return -ENOMEM;
426 sb->s_fs_info = sbi; 426 sb->s_fs_info = sbi;
427 sbi->sb = sb; 427 sbi->sb = sb;
428 sbi->uid = sbi->gid = sbi->umask = -1; 428 sbi->uid = sbi->gid = sbi->umask = -1;