Re: [PATCH] zonefs: Fix O_APPEND async write handling

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

 



On 2021/03/11 12:36, Darrick J. Wong wrote:
> On Thu, Mar 11, 2021 at 12:22:30PM +0900, Damien Le Moal wrote:
>> zonefs updates the size of a sequential zone file inode only on
>> completion of direct writes. When executing asynchronous append writes
>> (with a file open with O_APPEND or using RWF_APPEND), the use of the
>> current inode size in generic_write_checks() to set an iocb offset thus
>> leads to unaligned write if an application issues an append write
>> operation with another write already being executed.
> 
> Ah, I /had/ wondered if setting i_size to the zone size (instead of the
> write pointer) would have side effects...

In retrospect, the problem is obvious :)
But a hole in the test suite let this one slip for some time. That is fixed now.


[...]
>> +static ssize_t zonefs_write_checks(struct kiocb *iocb, struct iov_iter *from)
>> +{
>> +	struct file *file = iocb->ki_filp;
>> +	struct inode *inode = file_inode(file);
>> +	struct zonefs_inode_info *zi = ZONEFS_I(inode);
>> +	loff_t count;
>> +
>> +	if (IS_SWAPFILE(inode))
>> +		return -ETXTBSY;
> 
> ...but can zonefs really do swap files now?

Conventional zone files could, I guess, but I have not tested that. Not entirely
sure about this as I am not familiar with the swap code. I think it would be
safer to disallow swapfile use with zonefs, similarly to what claim_swap() does
with zoned block devices. But I am not sure how to do that. Sequential zone
files definitely will not be able to handle swap.



-- 
Damien Le Moal
Western Digital Research




[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