Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966191AbbBCGFr (ORCPT ); Tue, 3 Feb 2015 01:05:47 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:38730 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964964AbbBCGFo (ORCPT ); Tue, 3 Feb 2015 01:05:44 -0500 Date: Tue, 3 Feb 2015 06:05:42 +0000 From: Al Viro To: Alexander Holler Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/5] WIP: Add syscall unlinkat_s (currently x86* only) Message-ID: <20150203060542.GZ29656@ZenIV.linux.org.uk> References: <1422896713-25367-1-git-send-email-holler@ahsoftware.de> <1422896713-25367-2-git-send-email-holler@ahsoftware.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1422896713-25367-2-git-send-email-holler@ahsoftware.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1221 Lines: 29 On Mon, Feb 02, 2015 at 06:05:09PM +0100, Alexander Holler wrote: > + if (inode) { > + // TODO: > + // if (inode is file and 's' flag is set) > + // secure = true; > + if (!secure) > + iput(inode); /* truncate the inode here */ > + else { > + struct super_block *sb = inode->i_sb; > + if (sb->s_op->set_secure_delete) > + sb->s_op->set_secure_delete(sb, true); > + // TODO: We should fail if secure isn't supported, > + // look up how that's possible here. > + iput(inode); /* truncate the inode here */ > + // TODO: check if sb is still valid after the inode is gone > + sync_filesystem(sb); > + if (sb->s_op->set_secure_delete) > + sb->s_op->set_secure_delete(sb, false); > + } Charming. Now, what exactly happens if two such syscalls overlap in time? Moroever, what makes you equate unlink() with inode removal? What happens if you race e.g. with stat(2) on the same thing? Or if there's an opened file over that sucker, for that matter? -- 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/