Re: 2.4 bug: fifo-write causes diskwrites to read-only fs !

Stephen C. Tweedie (sct@redhat.com)
30 May 2003 16:18:53 +0100


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-10251-1054307975-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

Hi,

On Fri, 2003-05-30 at 15:58, Christoph Hellwig wrote:

> Yikes, this looks like devfs code! Please try to use proper kernel style..

It's pure cut-and-paste from the update_atime immediately above it. But
sure, we can clean them both up while we're at it if you want.

--Stephen

--=_courier-10251-1054307975-0001-2
Content-Type: text/plain; name="4202-vfs-mctime-rofs.patch"; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename=4202-vfs-mctime-rofs.patch

--- linux-2.4-odirect/fs/inode.c.=3DK0001=3D.orig
+++ linux-2.4-odirect/fs/inode.c
@@ -1187,12 +1187,34 @@ void update_atime (struct inode *inode)
{
if (inode->i_atime =3D=3D CURRENT_TIME)
return;
- if ( IS_NOATIME (inode) ) return;
- if ( IS_NODIRATIME (inode) && S_ISDIR (inode->i_mode) ) return;
- if ( IS_RDONLY (inode) ) return;
+ if (IS_NOATIME(inode))
+ return;
+ if (IS_NODIRATIME(inode) && S_ISDIR(inode->i_mode))=20
+ return;
+ if (IS_RDONLY(inode))=20
+ return;
inode->i_atime =3D CURRENT_TIME;
mark_inode_dirty_sync (inode);
-} /* End Function update_atime */
+}
+
+/**
+ * update_mctime - update the mtime and ctime
+ * @inode: inode accessed
+ *
+ * Update the modified and changed times on an inode for writes to special
+ * files such as fifos. No change is forced if the timestamps are already
+ * up-to-date or if the filesystem is readonly.
+ */
+=20
+void update_mctime (struct inode *inode)
+{
+ if (inode->i_mtime =3D=3D CURRENT_TIME && inode->i_ctime =3D=3D CURRENT_T=
IME)
+ return;
+ if (IS_RDONLY(inode))
+ return;
+ inode->i_ctime =3D inode->i_mtime =3D CURRENT_TIME;
+ mark_inode_dirty (inode);
+}
=20
=20
/*
--- linux-2.4-odirect/fs/pipe.c.=3DK0001=3D.orig
+++ linux-2.4-odirect/fs/pipe.c
@@ -230,8 +230,7 @@ pipe_write(struct file *filp, const char
/* Signal readers asynchronously that there is more data. */
wake_up_interruptible(PIPE_WAIT(*inode));
=20
- inode->i_ctime =3D inode->i_mtime =3D CURRENT_TIME;
- mark_inode_dirty(inode);
+ update_mctime(inode);
=20
out:
up(PIPE_SEM(*inode));
--- linux-2.4-odirect/include/linux/fs.h.=3DK0001=3D.orig
+++ linux-2.4-odirect/include/linux/fs.h
@@ -201,6 +201,7 @@ extern int leases_enable, dir_notify_ena
#include <asm/byteorder.h>
=20
extern void update_atime (struct inode *);
+extern void update_mctime (struct inode *);
#define UPDATE_ATIME(inode) update_atime (inode)
=20
extern void buffer_init(unsigned long);

--=_courier-10251-1054307975-0001-2--