] Stop the ISOFS filesystem from using read_inode(). Make isofs_read_inode()
PATCH 1/1 ] Stop the ISOFS filesystem from using read_inode(). Make isofs_read_inode()
return an error code, and make isofs_iget() pass it on. Furthermore isofs_iget() no longer ever returns NULL for situations where it used to, so all the places that call it must use IS_ERR() to check its return value.
---
fs/isofs/export.c | 14 ++++++------ fs/isofs/inode.c | 64 +++++++++++++++++++++++++++++++++++------------------ fs/isofs/namei.c | 4 ++- fs/isofs/rock.c | 4 ++- 4 files changed, 54 insertions(+), 32 deletions(-)
fs/isofs/export.c +7 -7
@@ -26,11 +26,9 @@ isofs_export_iget(struct super_block *sb,if (block ==0 )return ERR_PTR (-ESTALE ); inode =isofs_iget (sb, block, offset); -if (inode ==NULL ) -return ERR_PTR (-ENOMEM ); -if (is_bad_inode (inode) - || (generation && inode->i_generation != generation)) - { +if (IS_ERR (inode)) +return ERR_CAST (inode); +if (generation && inode->i_generation != generation) {iput (inode);return ERR_PTR (-ESTALE ); }
@@ -110,8 +108,10 @@ static struct dentry *isofs_export_get_parent(struct dentry *child) parent_inode =isofs_iget (child_inode->i_sb, parent_block, parent_offset); -if (parent_inode ==NULL ) { - rv =ERR_PTR (-EACCES ); +if (IS_ERR (parent_inode)) { + rv =ERR_CAST (parent_inode); +if (rv !=ERR_PTR (-ENOMEM )) + rv =ERR_PTR (-EACCES ); goto out; }
fs/isofs/inode.c +42 -22
202 lines not on this page · raw message
fs/isofs/namei.c +2 -2
@@ -179,9 +179,9 @@ struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, struct nam inode =NULL ;if (found) { inode =isofs_iget (dir->i_sb, block, offset); -if (!inode) { +if (IS_ERR (inode)) {unlock_kernel (); -return ERR_PTR (-EACCES ); +return ERR_CAST (inode); } }unlock_kernel ();
fs/isofs/rock.c +3 -1
@@ -474,8 +474,10 @@ repeat:isofs_iget (inode->i_sb,ISOFS_I (inode)->i_first_extent,0 ); -if (!reloc) +if (IS_ERR (reloc)) { + ret =PTR_ERR (reloc); goto out; + } inode->i_mode = reloc->i_mode; inode->i_nlink = reloc->i_nlink; inode->i_uid = reloc->i_uid;
Quoted 3 lines · David Howells
return an error code, and make
isofs_iget()pass it on. Furthermoreisofs_iget()no longer ever returns NULL for situations where it used to, so all the places that call it must useIS_ERR()to check its return value.
Seems "stg mail" dropped the first line of the text. Here's the complete patch.
David
---
Stop the ISOFS filesystem from using read_inode(). Make isofs_read_inode()
From: David Howells <[email protected]>
return an error code, and make isofs_iget() pass it on. Furthermore isofs_iget() no longer ever returns NULL for situations where it used to, so all the places that call it must use IS_ERR() to check its return value.
---
fs/isofs/export.c | 14 ++++++------ fs/isofs/inode.c | 64 +++++++++++++++++++++++++++++++++++------------------ fs/isofs/namei.c | 4 ++- fs/isofs/rock.c | 4 ++- 4 files changed, 54 insertions(+), 32 deletions(-)
fs/isofs/export.c +7 -7
@@ -26,11 +26,9 @@ isofs_export_iget(struct super_block *sb,if (block ==0 )return ERR_PTR (-ESTALE ); inode =isofs_iget (sb, block, offset); -if (inode ==NULL ) -return ERR_PTR (-ENOMEM ); -if (is_bad_inode (inode) - || (generation && inode->i_generation != generation)) - { +if (IS_ERR (inode)) +return ERR_CAST (inode); +if (generation && inode->i_generation != generation) {iput (inode);return ERR_PTR (-ESTALE ); }
@@ -110,8 +108,10 @@ static struct dentry *isofs_export_get_parent(struct dentry *child) parent_inode =isofs_iget (child_inode->i_sb, parent_block, parent_offset); -if (parent_inode ==NULL ) { - rv =ERR_PTR (-EACCES ); +if (IS_ERR (parent_inode)) { + rv =ERR_CAST (parent_inode); +if (rv !=ERR_PTR (-ENOMEM )) + rv =ERR_PTR (-EACCES ); goto out; }
fs/isofs/inode.c +42 -22
202 lines not on this page · raw message
fs/isofs/namei.c +2 -2
@@ -179,9 +179,9 @@ struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, struct nam inode =NULL ;if (found) { inode =isofs_iget (dir->i_sb, block, offset); -if (!inode) { +if (IS_ERR (inode)) {unlock_kernel (); -return ERR_PTR (-EACCES ); +return ERR_CAST (inode); } }unlock_kernel ();
fs/isofs/rock.c +3 -1
@@ -474,8 +474,10 @@ repeat:isofs_iget (inode->i_sb,ISOFS_I (inode)->i_first_extent,0 ); -if (!reloc) +if (IS_ERR (reloc)) { + ret =PTR_ERR (reloc); goto out; + } inode->i_mode = reloc->i_mode; inode->i_nlink = reloc->i_nlink; inode->i_uid = reloc->i_uid;