diff options
author | Akinobu Mita <mita@miraclelinux.com> | 2006-09-14 10:22:38 -0400 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-10-02 10:51:01 -0400 |
commit | 087387f90f577f5a0ab68d33ef326c9bb6d80dda (patch) | |
tree | 99f2ba6f672c9d98fbd628ee54120f63593f1bd0 /fs/jfs/jfs_inode.c | |
parent | 2a6968a9784551c216f9379a728d4104dbad98a8 (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/jfs/jfs_inode.c')
-rw-r--r-- | fs/jfs/jfs_inode.c | 9 |
1 files changed, 5 insertions, 4 deletions
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; |