Skip to contentSkip to conversation

VFS: Fix error handling of write_super_lockfs/unlockfs

PATCH In review Takashi Sato 2 participants 3 messages Sep 22, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/10 VFS: Fix error handling of write_super_lockfs/unlockfs

I've changed the type of write_super_lockfs and unlockfs from "void" to "int" so that they can return an error.

---
 Documentation/filesystems/Locking |    4 ++--
 Documentation/filesystems/vfs.txt |    4 ++--
 include/linux/fs.h                |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff -uprN -X linux-2.6.27-rc7.org/Documentation/dontdiff linux-2.6.27-rc7.org/Documentation/filesystems/Locking linux-2 .6.27-rc7-lockfs/Documentation/filesystems/Locking

Documentation/filesystems/Locking +2 -2
@@ -97,8 +97,8 @@ prototypes:
 	void (*put_super) (struct super_block *);
 	void (*write_super) (struct super_block *);
 	int (*sync_fs)(struct super_block *sb, int wait);
-	void (*write_super_lockfs) (struct super_block *);
-	void (*unlockfs) (struct super_block *);
+	int (*write_super_lockfs) (struct super_block *);
+	int (*unlockfs) (struct super_block *);
 	int (*statfs) (struct dentry *, struct kstatfs *);
 	int (*remount_fs) (struct super_block *, int *, char *);
 	void (*clear_inode) (struct inode *);

diff -uprN -X linux-2.6.27-rc7.org/Documentation/dontdiff linux-2.6.27-rc7.org/Documentation/filesystems/vfs.txt linux-2 .6.27-rc7-lockfs/Documentation/filesystems/vfs.txt

Documentation/filesystems/vfs.txt +2 -2
@@ -210,8 +210,8 @@ struct super_operations {
         void (*put_super) (struct super_block *);
         void (*write_super) (struct super_block *);
         int (*sync_fs)(struct super_block *sb, int wait);
-        void (*write_super_lockfs) (struct super_block *);
-        void (*unlockfs) (struct super_block *);
+        int (*write_super_lockfs) (struct super_block *);
+        int (*unlockfs) (struct super_block *);
         int (*statfs) (struct dentry *, struct kstatfs *);
         int (*remount_fs) (struct super_block *, int *, char *);
         void (*clear_inode) (struct inode *);

diff -uprN -X linux-2.6.27-rc7.org/Documentation/dontdiff linux-2.6.27-rc7.org/include/linux/fs.h linux-2.6.27-rc7-lockf s/include/linux/fs.h

include/linux/fs.h +2 -2
@@ -1314,8 +1314,8 @@ struct super_operations {
 	void (*put_super) (struct super_block *);
 	void (*write_super) (struct super_block *);
 	int (*sync_fs)(struct super_block *sb, int wait);
-	void (*write_super_lockfs) (struct super_block *);
-	void (*unlockfs) (struct super_block *);
+	int (*write_super_lockfs) (struct super_block *);
+	int (*unlockfs) (struct super_block *);
 	int (*statfs) (struct dentry *, struct kstatfs *);
 	int (*remount_fs) (struct super_block *, int *, char *);
 	void (*clear_inode) (struct inode *);
#1 lore raw
Quoted 2 lines · Takashi Sato

I've changed the type of write_super_lockfs and unlockfs from "void" to "int" so that they can return an error.

Returning an error from the freeze operation makes sense, but for the unfreeze I don't see the point. You must however change all existing instances to actually return a value (even if it's always 0 for now) to avoid breaking git bisect.

If you touch all instances anyway, it would be nice to rename them to freeze / unfreze as the current names are more confusing.

#2 lore raw

Re: [PATCH 1/10] VFS: Fix error handling ofwrite_super_lockfs/unlockfs

Hi,

Quoted 8 lines · Takashi Sato
Quoted 2 lines

I've changed the type of write_super_lockfs and unlockfs from "void" to "int" so that they can return an error.

Returning an error from the freeze operation makes sense, but for the unfreeze I don't see the point. You must however change all existing instances to actually return a value (even if it's always 0 for now) to avoid breaking git bisect.

I thought unlockfs should return an error because ext3_unlockfs() might cause I/O error in writing a super block.
But it is an internal error and the unfreezing succeeds. So I will consider returning 0.

Quoted 2 lines

If you touch all instances anyway, it would be nice to rename them to freeze / unfreze as the current names are more confusing.

I will consider renaming.

Cheers, Takashi