Re: Update of file offset on write() etc. is non-atomic with I/O

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

 



On Mon, Mar 03, 2014 at 03:59:36PM -0800, Linus Torvalds wrote:

> I doubt it's worth caring about. Even when passing things in memory,
> the end result isn't that much worse than the fget_light() model that
> passes just one of the two fields in memory.

I'm not sure if that's the right approach, TBH.  I wonder if something
like
static inline struct fd fdget(int fd)
{
	unsigned long v = __fdget(fd);
	return (struct fd){(struct file *)(v & ~1), v & 1};
}
would not be a better starting point, with __fdget(fd) being
{
        struct files_struct *files = current->files;
        struct file *file;
        if (atomic_read(&files->count) == 1) {
                file = __fcheck_files(files, fd);
                if (file && (file->f_mode & FMODE_PATH))
                        return 0;
		return (unsigned long)file;
        } else {
                file = __fget(fd, FMODE_PATH);
                return file ? 1 | (unsigned long)file : 0;
        }
}
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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