public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Peter Staubach <staubach@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] memory mapped files not updating timestamps
Date: Wed, 31 May 2006 21:38:48 +0200	[thread overview]
Message-ID: <447DF0C8.7030507@cosmosbay.com> (raw)
In-Reply-To: <447DD80C.2000408@redhat.com>

Peter Staubach a écrit :
> --- linux-2.6.16.i686/mm/msync.c.org
> +++ linux-2.6.16.i686/mm/msync.c
> @@ -206,12 +206,16 @@ asmlinkage long sys_msync(unsigned long 
>  		file = vma->vm_file;
>  		start = vma->vm_end;
>  		if ((flags & MS_ASYNC) && file && nr_pages_dirtied) {
> +			struct address_space *mapping = file->f_mapping;
> +
>  			get_file(file);
>  			up_read(&current->mm->mmap_sem);
> -			balance_dirty_pages_ratelimited_nr(file->f_mapping,
> +			balance_dirty_pages_ratelimited_nr(mapping,
>  							nr_pages_dirtied);
>  			fput(file);

<here>, another thread can perform an munmap(), and the file can be totally 
dismantled.

>  			down_read(&current->mm->mmap_sem);

So referencing 'mapping' is *buggy* here.
I believe that you have to move 'fput(file);' *after* the folloging two lines.

> +			if (test_and_clear_bit(AS_MCTIME, &mapping->flags))
> +				inode_update_time(mapping->host);
>  			vma = find_vma(current->mm, start);
>  		} else if ((flags & MS_SYNC) && file &&
>  				(vma->vm_flags & VM_SHARED)) {


Eric

  reply	other threads:[~2006-05-31 19:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-17 15:16 [PATCH] memory mapped files not updating timestamps Peter Staubach
2006-05-17 19:24 ` Hugh Dickins
2006-05-18 10:52   ` Peter Zijlstra
2006-05-18 22:13     ` Peter Staubach
2006-05-31 17:53 ` Peter Staubach
2006-05-31 19:38   ` Eric Dumazet [this message]
2006-05-31 20:38     ` Peter Staubach
2006-06-19  4:33   ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=447DF0C8.7030507@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=staubach@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox