From owner-svn-src-stable-10@FreeBSD.ORG Fri Sep 26 20:24:20 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A34F5DC; Fri, 26 Sep 2014 20:24:20 +0000 (UTC) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 741B5FB; Fri, 26 Sep 2014 20:24:19 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id d1so201920wiv.9 for ; Fri, 26 Sep 2014 13:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=eKTClaiMhfBMBfGtuHetbANAbPHjXrpDqutPbxEh75Y=; b=VJIr78kQ9M5XT5CG5rCxPERMZok/wx7/MxT2DgXkP+NPBWzO2HtOBIb0ygqVzcGQ+M acHezuEAWU9HOedErCzNHh12bDN/e5idKTRdN3GrYxa/xABFflHi0rDfYUhS+Etk022I SUtVoAQGnFvc/6yti+9tgr/fKxUuI10G7Q7A/Q/lTH+RSQWCncAdb9rASAeQTGra8QH3 RH25lqy08I0ExtHruK/2oGmo4mfhhT5EbTiy7N7fgqr4lH1mErgA64F0+jc4fNt91Bd7 O07hLskYuZ03MYvkWYwwAHsNjhhpXrhMl3AYu9odN5ZNxzK+GPLOpqNeIIfIOTe2MVsL aWhQ== X-Received: by 10.194.187.241 with SMTP id fv17mr26911352wjc.13.1411763057763; Fri, 26 Sep 2014 13:24:17 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id fo6sm3379415wic.3.2014.09.26.13.24.16 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 26 Sep 2014 13:24:16 -0700 (PDT) Date: Fri, 26 Sep 2014 22:24:14 +0200 From: Mateusz Guzik To: Mateusz Guzik Subject: Re: svn commit: r272187 - in stable/10/sys: kern sys Message-ID: <20140926202414.GB21954@dft-labs.eu> References: <201409262005.s8QK5TjD055931@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201409262005.s8QK5TjD055931@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Sep 2014 20:24:20 -0000 On Fri, Sep 26, 2014 at 08:05:29PM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Fri Sep 26 20:05:28 2014 > New Revision: 272187 > URL: http://svnweb.freebsd.org/changeset/base/272187 > > Log: > MFC r270993: > > Fix up proc_realparent to always return correct process. > > Prior to the change it would always return initproc for non-traced processes. > > This fixes a regression in inferior(). > > Approved by: re (marius) > Oops.. this is r270648. Still approvied by re (marius). > Modified: > stable/10/sys/kern/kern_descrip.c > stable/10/sys/kern/vfs_vnops.c > stable/10/sys/sys/file.h > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/sys/kern/kern_descrip.c > ============================================================================== > --- stable/10/sys/kern/kern_descrip.c Fri Sep 26 19:56:52 2014 (r272186) > +++ stable/10/sys/kern/kern_descrip.c Fri Sep 26 20:05:28 2014 (r272187) > @@ -477,7 +477,6 @@ kern_fcntl(struct thread *td, int fd, in > struct vnode *vp; > cap_rights_t rights; > int error, flg, tmp; > - u_int old, new; > uint64_t bsize; > off_t foffset; > > @@ -761,26 +760,24 @@ kern_fcntl(struct thread *td, int fd, in > error = EBADF; > break; > } > + vp = fp->f_vnode; > + /* > + * Exclusive lock synchronizes against f_seqcount reads and > + * writes in sequential_heuristic(). > + */ > + error = vn_lock(vp, LK_EXCLUSIVE); > + if (error != 0) { > + fdrop(fp, td); > + break; > + } > if (arg >= 0) { > - vp = fp->f_vnode; > - error = vn_lock(vp, LK_SHARED); > - if (error != 0) { > - fdrop(fp, td); > - break; > - } > bsize = fp->f_vnode->v_mount->mnt_stat.f_iosize; > - VOP_UNLOCK(vp, 0); > fp->f_seqcount = (arg + bsize - 1) / bsize; > - do { > - new = old = fp->f_flag; > - new |= FRDAHEAD; > - } while (!atomic_cmpset_rel_int(&fp->f_flag, old, new)); > + atomic_set_int(&fp->f_flag, FRDAHEAD); > } else { > - do { > - new = old = fp->f_flag; > - new &= ~FRDAHEAD; > - } while (!atomic_cmpset_rel_int(&fp->f_flag, old, new)); > + atomic_clear_int(&fp->f_flag, FRDAHEAD); > } > + VOP_UNLOCK(vp, 0); > fdrop(fp, td); > break; > > > Modified: stable/10/sys/kern/vfs_vnops.c > ============================================================================== > --- stable/10/sys/kern/vfs_vnops.c Fri Sep 26 19:56:52 2014 (r272186) > +++ stable/10/sys/kern/vfs_vnops.c Fri Sep 26 20:05:28 2014 (r272187) > @@ -438,7 +438,8 @@ static int > sequential_heuristic(struct uio *uio, struct file *fp) > { > > - if (atomic_load_acq_int(&(fp->f_flag)) & FRDAHEAD) > + ASSERT_VOP_LOCKED(fp->f_vnode, __func__); > + if (fp->f_flag & FRDAHEAD) > return (fp->f_seqcount << IO_SEQSHIFT); > > /* > > Modified: stable/10/sys/sys/file.h > ============================================================================== > --- stable/10/sys/sys/file.h Fri Sep 26 19:56:52 2014 (r272186) > +++ stable/10/sys/sys/file.h Fri Sep 26 20:05:28 2014 (r272187) > @@ -139,6 +139,7 @@ struct fileops { > * > * Below is the list of locks that protects members in struct file. > * > + * (a) f_vnode lock required (shared allows both reads and writes) > * (f) protected with mtx_lock(mtx_pool_find(fp)) > * (d) cdevpriv_mtx > * none not locked > @@ -164,7 +165,7 @@ struct file { > /* > * DTYPE_VNODE specific fields. > */ > - int f_seqcount; /* Count of sequential accesses. */ > + int f_seqcount; /* (a) Count of sequential accesses. */ > off_t f_nextoff; /* next expected read/write offset. */ > union { > struct cdev_privdata *fvn_cdevpriv; > -- Mateusz Guzik