From patchwork Tue Apr 5 14:08:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 8752411 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 D53E1C0553 for ; Tue, 5 Apr 2016 14:08:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA35120382 for ; Tue, 5 Apr 2016 14:08:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41032201BC for ; Tue, 5 Apr 2016 14:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759300AbcDEOIL (ORCPT ); Tue, 5 Apr 2016 10:08:11 -0400 Received: from prv-mh.provo.novell.com ([137.65.248.74]:38511 "EHLO prv-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759282AbcDEOIK convert rfc822-to-8bit (ORCPT ); Tue, 5 Apr 2016 10:08:10 -0400 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Tue, 05 Apr 2016 08:08:09 -0600 Message-Id: <5703E2E602000078000E3331@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Tue, 05 Apr 2016 08:08:05 -0600 From: "Jan Beulich" To: Cc: "Linus Torvalds" , Subject: [PATCH] vfs: avoid atomic f_pos accesses for non-seekable files Mime-Version: 1.0 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.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 Commit 9c225f2655 ("vfs: atomic f_pos accesses as per POSIX") may have gone a little too far: We've had a report of a deadlock of an application accessing a /proc file through the same file descriptor from multiple threads. While /proc files are regular ones, them (and similarly others which are) often not being seekable really already makes them deviate from how regular files would behave. Since for non-seekable files the file position is kind of a strange thing anyway, also don't enforce atomic position updates for them. (I do recognize that the application isn't really standard conforming, as it should use multiple file descriptors from all I understand. But it worked fine before that change, and so they claim the kernel to be at fault.) Signed-off-by: Jan Beulich Cc: Linus Torvalds --- fs/open.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 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 --- 4.6-rc2/fs/open.c +++ 4.6-rc2-nonseekable-no-atomic-pos/fs/open.c @@ -1142,7 +1142,8 @@ EXPORT_SYMBOL(generic_file_open); */ int nonseekable_open(struct inode *inode, struct file *filp) { - filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE); + filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE | + FMODE_ATOMIC_POS); return 0; }