|
@@ -184,11 +184,19 @@ just takes the superblock and inode number as arguments and does the
|
|
|
test and set for you.
|
|
|
|
|
|
e.g.
|
|
|
- inode = iget_locked(sb, ino);
|
|
|
- if (inode->i_state & I_NEW) {
|
|
|
- read_inode_from_disk(inode);
|
|
|
- unlock_new_inode(inode);
|
|
|
- }
|
|
|
+ inode = iget_locked(sb, ino);
|
|
|
+ if (inode->i_state & I_NEW) {
|
|
|
+ err = read_inode_from_disk(inode);
|
|
|
+ if (err < 0) {
|
|
|
+ iget_failed(inode);
|
|
|
+ return err;
|
|
|
+ }
|
|
|
+ unlock_new_inode(inode);
|
|
|
+ }
|
|
|
+
|
|
|
+Note that if the process of setting up a new inode fails, then iget_failed()
|
|
|
+should be called on the inode to render it dead, and an appropriate error
|
|
|
+should be passed back to the caller.
|
|
|
|
|
|
---
|
|
|
[recommended]
|