diff options
author | Michael I. Bushnell <mib@gnu.org> | 1995-03-31 18:43:23 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1995-03-31 18:43:23 +0000 |
commit | 0f40a399103893c73274af1b7a5e8ddafc71d963 (patch) | |
tree | b30f606cbb31ac7a7c37f7f0ddee3eeaea592055 | |
parent | 3fbfd55e3989af37af9aeb073455abee32a1b885 (diff) |
(diskfs_truncate): Don't acquire writer lock on NP->dn->allocptrlock
until after forcing delayed copies through; otherwise the pageins will
deadlock attempting to get a reader lock to service them. This is
safe, because we only need NP->allocsize here, and that can't change
as long as we hold NP->lock.
-rw-r--r-- | ufs/sizes.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ufs/sizes.c b/ufs/sizes.c index bf9e2c38..ef7666b1 100644 --- a/ufs/sizes.c +++ b/ufs/sizes.c @@ -1,5 +1,5 @@ /* File growth and truncation - Copyright (C) 1993, 1994 Free Software Foundation + Copyright (C) 1993, 1994, 1995 Free Software Foundation This file is part of the GNU Hurd. @@ -83,13 +83,11 @@ diskfs_truncate (struct node *np, diskfs_file_update (np, 1); } - rwlock_writer_lock (&np->dn->allocptrlock); - /* Now flush all the data past the new size from the kernel. Also force any delayed copies of this data to take place - immediately. (We are changing the data implicitly to zeros - and doing it without the kernels immediate knowledge; - this forces us to help out the kernel thusly.) */ + immediately. (We are implicitly changing the data to zeros + and doing it without the kernel's immediate knowledge; + accordingl we must help out the kernel thusly.) */ spin_lock (&node2pagelock); upi = np->dn->fileinfo; if (upi) @@ -110,6 +108,8 @@ diskfs_truncate (struct node *np, pager_unreference (upi->p); } + rwlock_writer_lock (&np->dn->allocptrlock); + /* Update the size on disk; fsck will finish freeing blocks if necessary should we crash. */ np->dn_stat.st_size = length; |