Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756940AbYGKSSZ (ORCPT ); Fri, 11 Jul 2008 14:18:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755861AbYGKSSG (ORCPT ); Fri, 11 Jul 2008 14:18:06 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:41157 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754849AbYGKSSF (ORCPT ); Fri, 11 Jul 2008 14:18:05 -0400 Date: Fri, 11 Jul 2008 11:16:40 -0700 (PDT) From: Linus Torvalds To: Roland McGrath cc: Ingo Molnar , Thomas Gleixner , Andrew Morton , linux-kernel@vger.kernel.org, Elias Oltmanns , =?ISO-8859-15?Q?T=F6r=F6k_Edwin?= , Arjan van de Ven Subject: Re: [PATCH] x86_64: fix delayed signals In-Reply-To: <20080711180757.37CC9154213@magilla.localdomain> Message-ID: References: <20080710215039.2A143154218@magilla.localdomain> <20080711054605.GA17851@elte.hu> <20080711180757.37CC9154213@magilla.localdomain> User-Agent: Alpine 1.10 (LFD 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1588 Lines: 49 On Fri, 11 Jul 2008, Roland McGrath wrote: > > > + /* Only check signals if we have filled at least one entry! */ > > + if (signal_pending(current)) > > + return -EINTR; > > Shouldn't it return the short count? > (And if not, then probably should be -ERESTARTSYS.) readdir (getdents) is a complex system call, and the path is sys_getdents64() -> vfs_readdir (with 'filldir64' as a callback) -> low-level filesystem 'readdir' function -> filldir64 callback and what happens is that when that 'filldir64()' callback returns an error, the low-level filesystem just stops and returns with a success (because everything worked for _it_ - it was the callback that errored out). The 'sys_getdents64()' then does: .. lastdirent = buf.previous; if (lastdirent) { typeof(lastdirent->d_off) d_off = file->f_pos; error = -EFAULT; if (__put_user(d_off, &lastdirent->d_off)) goto out_putf; error = count - buf.count; } .. ie we'll do that "return partial buffer size" at that level, not deep in the callback. So making the callback just return an error is the right thing to do - because the callers will then fix up the file offset in the last directory entry and the final return value. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/