Commit f4defcee authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: Missed some non-negative error return codes

parent eb40c469
...@@ -105,7 +105,7 @@ int jfs_commit_inode(struct inode *inode, int wait) ...@@ -105,7 +105,7 @@ int jfs_commit_inode(struct inode *inode, int wait)
rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0); rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0);
txEnd(tid); txEnd(tid);
up(&JFS_IP(inode)->commit_sem); up(&JFS_IP(inode)->commit_sem);
return -rc; return rc;
} }
void jfs_write_inode(struct inode *inode, int wait) void jfs_write_inode(struct inode *inode, int wait)
......
...@@ -1328,7 +1328,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split, ...@@ -1328,7 +1328,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
rbn = addressPXD(pxd); rbn = addressPXD(pxd);
rmp = get_metapage(ip, rbn, PSIZE, 1); rmp = get_metapage(ip, rbn, PSIZE, 1);
if (rmp == NULL) if (rmp == NULL)
return EIO; return -EIO;
jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp); jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp);
......
...@@ -1615,7 +1615,7 @@ static int lmLogFileSystem(struct jfs_log * log, char *uuid, int activate) ...@@ -1615,7 +1615,7 @@ static int lmLogFileSystem(struct jfs_log * log, char *uuid, int activate)
if (i == MAX_ACTIVE) { if (i == MAX_ACTIVE) {
jfs_warn("Too many file systems sharing journal!"); jfs_warn("Too many file systems sharing journal!");
lbmFree(bpsuper); lbmFree(bpsuper);
return EMFILE; /* Is there a better rc? */ return -EMFILE; /* Is there a better rc? */
} }
} else { } else {
for (i = 0; i < MAX_ACTIVE; i++) for (i = 0; i < MAX_ACTIVE; i++)
......
...@@ -178,7 +178,7 @@ void inlineLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, ...@@ -178,7 +178,7 @@ void inlineLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
struct tlock * tlck); struct tlock * tlck);
void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
struct tlock * tlck); struct tlock * tlck);
void txAbortCommit(struct commit * cd, int exval); static void txAbortCommit(struct commit * cd);
static void txAllocPMap(struct inode *ip, struct maplock * maplock, static void txAllocPMap(struct inode *ip, struct maplock * maplock,
struct tblock * tblk); struct tblock * tblk);
void txForce(struct tblock * tblk); void txForce(struct tblock * tblk);
...@@ -1113,7 +1113,7 @@ int txCommit(tid_t tid, /* transaction identifier */ ...@@ -1113,7 +1113,7 @@ int txCommit(tid_t tid, /* transaction identifier */
jfs_info("txCommit, tid = %d, flag = %d", tid, flag); jfs_info("txCommit, tid = %d, flag = %d", tid, flag);
/* is read-only file system ? */ /* is read-only file system ? */
if (isReadOnly(iplist[0])) { if (isReadOnly(iplist[0])) {
rc = EROFS; rc = -EROFS;
goto TheEnd; goto TheEnd;
} }
...@@ -1317,7 +1317,7 @@ int txCommit(tid_t tid, /* transaction identifier */ ...@@ -1317,7 +1317,7 @@ int txCommit(tid_t tid, /* transaction identifier */
out: out:
if (rc != 0) if (rc != 0)
txAbortCommit(&cd, rc); txAbortCommit(&cd);
TheEnd: TheEnd:
jfs_info("txCommit: tid = %d, returning %d", tid, rc); jfs_info("txCommit: tid = %d, returning %d", tid, rc);
...@@ -2672,14 +2672,13 @@ void txAbort(tid_t tid, int dirty) ...@@ -2672,14 +2672,13 @@ void txAbort(tid_t tid, int dirty)
* log age of page-frames in memory for which caller has * log age of page-frames in memory for which caller has
* are reset to 0 (to avoid logwarap). * are reset to 0 (to avoid logwarap).
*/ */
void txAbortCommit(struct commit * cd, int exval) static void txAbortCommit(struct commit * cd)
{ {
struct tblock *tblk; struct tblock *tblk;
tid_t tid; tid_t tid;
lid_t lid, next; lid_t lid, next;
struct metapage *mp; struct metapage *mp;
assert(exval == EIO || exval == ENOMEM);
jfs_warn("txAbortCommit: cd:0x%p", cd); jfs_warn("txAbortCommit: cd:0x%p", cd);
/* /*
......
...@@ -120,7 +120,7 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode, ...@@ -120,7 +120,7 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
ino = ip->i_ino; ino = ip->i_ino;
if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) { if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) {
jfs_err("jfs_create: dtInsert returned %d", rc); jfs_err("jfs_create: dtInsert returned %d", rc);
if (rc == EIO) if (rc == -EIO)
txAbort(tid, 1); /* Marks Filesystem dirty */ txAbort(tid, 1); /* Marks Filesystem dirty */
else else
txAbort(tid, 0); /* Filesystem full */ txAbort(tid, 0); /* Filesystem full */
...@@ -247,7 +247,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) ...@@ -247,7 +247,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) { if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) {
jfs_err("jfs_mkdir: dtInsert returned %d", rc); jfs_err("jfs_mkdir: dtInsert returned %d", rc);
if (rc == EIO) if (rc == -EIO)
txAbort(tid, 1); /* Marks Filesystem dirty */ txAbort(tid, 1); /* Marks Filesystem dirty */
else else
txAbort(tid, 0); /* Filesystem full */ txAbort(tid, 0); /* Filesystem full */
...@@ -353,7 +353,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry) ...@@ -353,7 +353,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry)
ino = ip->i_ino; ino = ip->i_ino;
if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) { if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) {
jfs_err("jfs_rmdir: dtDelete returned %d", rc); jfs_err("jfs_rmdir: dtDelete returned %d", rc);
if (rc == EIO) if (rc == -EIO)
txAbort(tid, 1); txAbort(tid, 1);
txEnd(tid); txEnd(tid);
up(&JFS_IP(dip)->commit_sem); up(&JFS_IP(dip)->commit_sem);
...@@ -469,7 +469,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry) ...@@ -469,7 +469,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
ino = ip->i_ino; ino = ip->i_ino;
if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) { if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) {
jfs_err("jfs_unlink: dtDelete returned %d", rc); jfs_err("jfs_unlink: dtDelete returned %d", rc);
if (rc == EIO) if (rc == -EIO)
txAbort(tid, 1); /* Marks FS Dirty */ txAbort(tid, 1); /* Marks FS Dirty */
txEnd(tid); txEnd(tid);
up(&JFS_IP(dip)->commit_sem); up(&JFS_IP(dip)->commit_sem);
...@@ -535,7 +535,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry) ...@@ -535,7 +535,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
new_size = xtTruncate_pmap(tid, ip, new_size); new_size = xtTruncate_pmap(tid, ip, new_size);
if (new_size < 0) { if (new_size < 0) {
txAbort(tid, 1); /* Marks FS Dirty */ txAbort(tid, 1); /* Marks FS Dirty */
rc = -new_size; /* We return -rc */ rc = new_size;
} else } else
rc = txCommit(tid, 2, &iplist[0], COMMIT_SYNC); rc = txCommit(tid, 2, &iplist[0], COMMIT_SYNC);
txEnd(tid); txEnd(tid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment