From: Jeff Layton Subject: Re: [PATCH v23 05/22] vfs: Add permission flags for setting file attributes Date: Tue, 05 Jul 2016 07:18:41 -0400 Message-ID: <1467717521.3800.11.camel@redhat.com> References: <1467294433-3222-1-git-send-email-agruenba@redhat.com> <1467294433-3222-6-git-send-email-agruenba@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: "J. Bruce Fields" , linux-nfs@vger.kernel.org, Theodore Ts'o , linux-cifs@vger.kernel.org, linux-api@vger.kernel.org, Trond Myklebust , linux-kernel@vger.kernel.org, xfs@oss.sgi.com, Christoph Hellwig , Andreas Dilger , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Anna Schumaker To: Andreas Gruenbacher , Alexander Viro Return-path: In-Reply-To: <1467294433-3222-6-git-send-email-agruenba@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com List-Id: linux-ext4.vger.kernel.org T24gVGh1LCAyMDE2LTA2LTMwIGF0IDE1OjQ2ICswMjAwLCBBbmRyZWFzIEdydWVuYmFjaGVyIHdy b3RlOgo+IFJpY2hhY2xzIHN1cHBvcnQgcGVybWlzc2lvbnMgdGhhdCBhbGxvdyB0byB0YWtlIG93 bmVyc2hpcCBvZiBhIGZpbGUsCj4gY2hhbmdlIHRoZSBmaWxlIHBlcm1pc3Npb25zLCBhbmQgc2V0 IHRoZSBmaWxlIHRpbWVzdGFtcHMuwqDCoFN1cHBvcnQgdGhhdAo+IGJ5IGludHJvZHVjaW5nIG5l dyBwZXJtaXNzaW9uIG1hc2sgZmxhZ3MgYW5kIGJ5IGNoZWNraW5nIGZvciB0aG9zZSBtYXNrCj4g ZmxhZ3MgaW4gaW5vZGVfY2hhbmdlX29rKCkuCj4gCj4gU2lnbmVkLW9mZi1ieTogQW5kcmVhcyBH cnVlbmJhY2hlciA8YWdydWVuYmFAcmVkaGF0LmNvb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