From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 5 23:33:16 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B609A16A4D0; Wed, 5 Jan 2005 23:33:16 +0000 (GMT) Received: from mail-svr1.cs.utah.edu (mail-svr1.cs.utah.edu [155.98.64.200]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8BEB143D2D; Wed, 5 Jan 2005 23:33:16 +0000 (GMT) (envelope-from saggarwa@cs.utah.edu) Received: from localhost (localhost [127.0.0.1]) by mail-svr1.cs.utah.edu (Postfix) with ESMTP id 39BC8346ED; Wed, 5 Jan 2005 16:33:16 -0700 (MST) Received: from mail-svr1.cs.utah.edu ([127.0.0.1]) by localhost (mail-svr1.cs.utah.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01793-10; Wed, 5 Jan 2005 16:33:16 -0700 (MST) Received: from faith.cs.utah.edu (faith.cs.utah.edu [155.98.65.40]) by mail-svr1.cs.utah.edu (Postfix) with ESMTP id D8034346D9; Wed, 5 Jan 2005 16:33:15 -0700 (MST) Received: by faith.cs.utah.edu (Postfix, from userid 4973) id 7F3452EC21; Wed, 5 Jan 2005 16:33:13 -0700 (MST) Received: from localhost (localhost [127.0.0.1]) by faith.cs.utah.edu (Postfix) with ESMTP id D069D34406; Wed, 5 Jan 2005 23:33:13 +0000 (UTC) Date: Wed, 5 Jan 2005 16:33:13 -0700 (MST) From: Siddharth Aggarwal To: freebsd-fs@freebsd.org, "" Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: amavisd-new at cs.utah.edu X-Mailman-Approved-At: Thu, 06 Jan 2005 14:14:57 +0000 Subject: write retry on filesystem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2005 23:33:16 -0000 Hi, I have a pseudo disk driver that does a copy on write to a log device. I want to disable further retries to write if the disk space on the log device is full. I have inserted the following code into the strategy routine For this I have set the error code and also set the resid to zero, thinking that the filesystem above will not retry the operation because it assumes that there are no more bytes to be written (since I set resid to 0). However, control keeps coming back to this code, suggesting that the FS (buffer cache) is constantly retrying the operation. Is there any other way to do this (maybe I should try a different error code. I tried ENOSPC too). The reason I want to disable retry is to allow the user to manually select and delete logs to reclaim space and then do the file operation again if he chooses to. The problem arising is because the buffer cache is asynchronously flushed to disk (which could be much after a vfs file write operation). So the application has no way of knowing that a write to disk failed because COW failed due to log device space shortage. So the syncer periodically keeps trying to flush the buffer cache to disk because every time the strategy routine (in my driver which is between the buffer cache and the disk) cannot complete the operation. Any suggestions on how I can accomplish this? Any suggested hack in vfs_bio? Thanks, Sid. strategy () { ..... if (failed < 0) /* no more free space on log device */ { printf ("No more space on disk! Copy on write failed\n"); bp->b_error = EACCES; bp->b_flags |= B_ERROR; bp->b_resid = 0; devstat_end_transaction_buf(&ss->device_stats, bp); biodone(bp); return; } .... }