[patch-2.3.32-pre3] lock_kernel() in fsync(2)

Tigran Aivazian (tigran@sco.COM)
Mon, 13 Dec 1999 16:06:48 +0000 (GMT)


Hi,

Both fget() and fput() seem to be reentrant so even if we assume that
down(&inode->i_sem) is not enough for fop->fsync(), we could
move lock/unlock_kernel() closer to it like this, right (fs/buffer.c)?

--- buffer.c.0 Mon Dec 13 16:57:15 1999
+++ buffer.c Mon Dec 13 16:57:31 1999
@@ -347,7 +347,6 @@
struct inode * inode;
int err;

- lock_kernel();
err = -EBADF;
file = fget(fd);
if (!file)
@@ -366,14 +365,15 @@
goto out_putf;

/* We need to protect against concurrent writers.. */
+ lock_kernel();
down(&inode->i_sem);
err = file->f_op->fsync(file, dentry);
up(&inode->i_sem);
+ unlock_kernel();

out_putf:
fput(file);
out:
- unlock_kernel();
return err;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/