Skip to contentSkip to conversation

better file error debugging

PATCH In review Dave Hansen 2 participants 2 messages Jun 25, 2009 – Jun 27, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 better file error debugging

This should give a nice message with symbol names for when we have an open file that doesn't have an f_op->checkpoint.

Something along the lines of:

[1133:c/r:checkpoint_file] file operations have no checkpoint handler:tty_open+0x0/0x24

checkpoint/files.c +4 -1
index 5be7d1b..566fc9a 100644
@@ -193,8 +193,11 @@ int checkpoint_file(struct ckpt_ctx *ctx, void *ptr)
 {
 	struct file *file = (struct file *) ptr;
 
-	if (!file->f_op || !file->f_op->checkpoint)
+	if (!file->f_op || !file->f_op->checkpoint) {
+		ckpt_debug("file operations have no checkpoint handler: %pS\n",
+				file->f_op);
 		return -EBADF;
+	}
 	if (d_unhashed(file->f_dentry) && !IS_ROOT(file->f_dentry))
 		return -EBADF;
 	return file->f_op->checkpoint(ctx, file);

-- Dave

#1 lore raw
Quoted 7 lines · Dave Hansen

This should give a nice message with symbol names for when we have an open file that doesn't have an f_op->checkpoint.

Something along the lines of:

[1133:c/r:checkpoint_file] file operations have no checkpoint handler:tty_open+0x0/0x24

Nice, thanks.

Added with another ckpt_debug() for the unlinked file case.

Oren.

Quoted 23 lines
checkpoint/files.c +4 -2
index 5be7d1b..566fc9a 100644
@@ -193,8 +193,11 @@ int checkpoint_file(struct ckpt_ctx *ctx, void *ptr)
 {
 	struct file *file = (struct file *) ptr;
 
-	if (!file->f_op || !file->f_op->checkpoint)
+	if (!file->f_op || !file->f_op->checkpoint) {
+		ckpt_debug("file operations have no checkpoint handler: %pS\n",
+				file->f_op);
 		return -EBADF;
+	}
 	if (d_unhashed(file->f_dentry) && !IS_ROOT(file->f_dentry))
 		return -EBADF;
 	return file->f_op->checkpoint(ctx, file);
 
 
 
-- Dave