lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87odomw74j.fsf@sw.ru>
Date:	Fri, 26 Jan 2007 10:59:40 +0300
From:	Dmitriy Monakhov <dmonakhov@...ru>
To:	Andrew Morton <akpm@...l.org>
Cc:	Dmitriy Monakhov <dmonakhov@...ru>, linux-kernel@...r.kernel.org,
	devel@...nvz.org
Subject: Re: [PATCH][RFC] incorrect direct io error handling (v3)

Andrew Morton <akpm@...l.org> writes:

> On Wed, 24 Jan 2007 22:05:06 +0300
> Dmitriy Monakhov <dmonakhov@...ru> wrote:
>
>> incorrect direct io error handling (v3)
>> Changes from v2:
>>  - Remove BUG_ON(!mutex_is_locked(..)) for non blkdev.
>>  - vmtruncate() called from generic_file_aio_write().
>>  - depends on patch titled:
>>    [PATH][RFC] mm: Move common segments checks to separate function
>
> drat, I skipped that patch due to rejects, and because Nick is working on
> things in the same area.
>
[skip]
>>  	if ((written >= 0 || written == -EIOCBQUEUED) &&
>>  	    ((file->f_flags & O_SYNC) || IS_SYNC(inode))) {
>> @@ -2365,6 +2366,17 @@ ssize_t generic_file_aio_write(struct ki
>>  			&iocb->ki_pos);
>>  	mutex_unlock(&inode->i_mutex);
>>  
>> +	if (unlikely(ret < 0 && (file->f_flags & O_DIRECT))) {
>> +		ssize_t cnt = generic_segment_checks(nr_segs, iov, VERIFY_READ);
>> +		loff_t isize = i_size_read(inode);
>> +		/*
>> +		 * generic_file_direct_write() may have instantiated a few 
>> +		 * blocks outside i_size.  Trim these off again.
>> +		 */
>> +		if (cnt > 0 && (pos + cnt > isize))
>> +			vmtruncate(inode, isize);
>> +	}
>> +
>
> vmtruncate() really wants i_mutex to be held.  Can't we do that here?
Yepp 110% true, baaahh ..... it looks like my brain was't clear at the time i
wrote this. We have to do vmtruncate() brfore droping i_mutex , right after
__generic_file_aio_write_nolock() call , i'm sorry to waste your time. 
    

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ