From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992861AbXCIBe0 (ORCPT ); Thu, 8 Mar 2007 20:34:26 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S2992865AbXCIBe0 (ORCPT ); Thu, 8 Mar 2007 20:34:26 -0500 Received: from kanga.kvack.org ([66.96.29.28]:48577 "EHLO kanga.kvack.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2992861AbXCIBeZ (ORCPT ); Thu, 8 Mar 2007 20:34:25 -0500 Date: Thu, 8 Mar 2007 20:34:05 -0500 From: Benjamin LaHaise To: "Michael K. Edwards" Cc: Eric Dumazet , Linux Kernel Mailing List Subject: Re: sys_write() racy for multi-threaded append? Message-ID: <20070309013405.GI6209@kvack.org> References: <45F09F9C.4030801@cosmosbay.com> <45F0A71C.2000800@cosmosbay.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org > Actually, I think it would make the kernel (negligibly) faster to bump > f_pos before the vfs_write() call. Unless fget_light sets fput_needed > or the write doesn't complete cleanly, you won't have to touch the > file table entry again after vfs_write() returns. You can adjust Any number of things can cause a short write to occur, and rewinding the file position after the fact is just as bad. A sane app has to either serialise the writes itself or use a thread safe API like pwrite(). -ben -- "Time is of no importance, Mr. President, only life is important." Don't Email: .