Re: Question about `generic_write_checks()` FIXME comment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 30, 2021 at 03:07:25AM -0500, Hans Montero wrote:
> We noticed the FIXME comment and we weren't sure exactly what it meant so we
> kept tracing through older versions of `generic_write_checks()`, going as far as
> Linux 2.5.75, before it was implemented for `write_iter()` usage:
> 
>   if (!isblk) {
>           /* FIXME: this is for backwards compatibility with 2.4 */
>           if (file->f_flags & O_APPEND)
>                   *pos = inode->i_size;
>           ...
>   }

I was able to trace it back farther, to v2.4.14.8 -> v2.4.14.9.  And it
looks like the mysterious FIXME is about the block device:

commit 1040c54c3b98ac4f8d91bc313cdc9d6669481da3
Author: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Date:   Mon Feb 4 20:33:54 2002 -0800
	...
@@ -2765,7 +2876,8 @@ generic_file_write(struct file *file,const char *buf,size_t count, loff_t *ppos)
 
 	written = 0;
 
-	if (file->f_flags & O_APPEND)
+	/* FIXME: this is for backwards compatibility with 2.4 */
+	if (!S_ISBLK(inode->i_mode) && file->f_flags & O_APPEND)
 		pos = inode->i_size;
 
 	/*

 But as Al Viro pointed out, O_APPEND really can't have any real
 meaning for a block device.  It would be neat if we could magically
 make a 10TB HDD to become as 12TB HDD by writing 2TB using
 O_APPEND, but reality doesn't work that way.  :-)

It probably makes sense just to remove the FIXME from the current
kernel sources so that future people don't get confused, asking the
same questions you have.

Cheers,

						- Ted



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux