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 | bee30b19142cc6a0f9ca98c8936d3c439f0b9d16 (patch) | |
tree | a513ab617e43c5b48b4e9a27331ab38a3f2c1fa0 /ufs/sizes.c | |
parent | 520105244a77aabb592432400f0746dfc757bee5 (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.
Diffstat (limited to 'ufs/sizes.c')
-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; |