bfs: correct return values
authorSanidhya Kashyap <sanidhya.gatech@gmail.com>
Thu, 16 Apr 2015 19:48:32 +0000 (12:48 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Apr 2015 13:04:09 +0000 (09:04 -0400)
In case of failed memory allocation, the return should be ENOMEM instead
of ENOSPC.

Return -EIO when sb_bread() fails.

Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/bfs/dir.c

index 08063ae0a17cd631b0c3194ea68043045f7cce05..7a8182770649dd48b3a35a1b28dfa1ff13252e6b 100644 (file)
@@ -86,7 +86,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 
        inode = new_inode(s);
        if (!inode)
-               return -ENOSPC;
+               return -ENOMEM;
        mutex_lock(&info->bfs_lock);
        ino = find_first_zero_bit(info->si_imap, info->si_lasti + 1);
        if (ino > info->si_lasti) {
@@ -293,7 +293,7 @@ static int bfs_add_entry(struct inode *dir, const unsigned char *name,
        for (block = sblock; block <= eblock; block++) {
                bh = sb_bread(dir->i_sb, block);
                if (!bh)
-                       return -ENOSPC;
+                       return -EIO;
                for (off = 0; off < BFS_BSIZE; off += BFS_DIRENT_SIZE) {
                        de = (struct bfs_dirent *)(bh->b_data + off);
                        if (!de->ino) {