From patchwork Thu Jan 14 22:25:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 8036311 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 17B7CBEEE5 for ; Thu, 14 Jan 2016 22:26:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 47CEA204A9 for ; Thu, 14 Jan 2016 22:26:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C6EC203B4 for ; Thu, 14 Jan 2016 22:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756988AbcANWZs (ORCPT ); Thu, 14 Jan 2016 17:25:48 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:34663 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756977AbcANWZr (ORCPT ); Thu, 14 Jan 2016 17:25:47 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.76 #1 (Red Hat Linux)) id 1aJqKu-0007b8-HW; Thu, 14 Jan 2016 22:25:44 +0000 Date: Thu, 14 Jan 2016 22:25:44 +0000 From: Al Viro To: Linus Torvalds Cc: Tomeu Vizoso , "linux-kernel@vger.kernel.org" , Neil Brown , linux-fsdevel Subject: Re: [PATCH v2 06/11] don't put symlink bodies in pagecache into highmem Message-ID: <20160114222544.GB17997@ZenIV.linux.org.uk> References: <1449639295-20512-6-git-send-email-viro@ZenIV.linux.org.uk> <20160114152553.GW17997@ZenIV.linux.org.uk> <20160114162333.GX17997@ZenIV.linux.org.uk> <20160114171341.GY17997@ZenIV.linux.org.uk> <20160114210223.GA17997@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Jan 14, 2016 at 01:40:32PM -0800, Linus Torvalds wrote: > On Thu, Jan 14, 2016 at 1:02 PM, Al Viro wrote: > > > > Arrrgh. Try this: > > Yeah, that would do it. > > Al, did you check any other filesystems do this? There's one more turd like that - shmem should've done inode_nohighmem() a bit earlier in shmem_symlink(). The rest is OK. > Also, I'm wondering if we should perhaps revert the "don't use > highmem". Do we actually have examples of running out of kmaps? Do we > care? For one thing, we'll lose RCU ->get_link() for those. For another... yes, it was a nasty bug (I missed the possibility that filesystem might seed the page cache on ->symlink() directly and use a highmem page - mea culpa), but we can easily catch it at runtime. We really shouldn't put highmem pages into address_space without __GFP_HIGHMEM, and catching those in __add_to_page_cache_locked() isn't costly. Anyway, mm/shmem.c bit follows. With that + NFS one we ought to be OK wrt that class of bogosities. I'll write the bits for Documentation/filesystems/porting (basically, "if you preseed the pagecache at ->symlink() time, don't put highmem pages there; page_symlink() will take care of that, provided that inode_nohighmem() is called first") and push the combined patch to #for-linus. --- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/mm/shmem.c b/mm/shmem.c index 5813b7f..642471b 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2469,6 +2469,7 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s inode->i_op = &shmem_short_symlink_operations; inode->i_link = info->symlink; } else { + inode_nohighmem(inode); error = shmem_getpage(inode, 0, &page, SGP_WRITE, NULL); if (error) { iput(inode); @@ -2476,7 +2477,6 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s } inode->i_mapping->a_ops = &shmem_aops; inode->i_op = &shmem_symlink_inode_operations; - inode_nohighmem(inode); memcpy(page_address(page), symname, len); SetPageUptodate(page); set_page_dirty(page);