Re: [PATCH] hugetlbfs read() support

Nick Piggin
2007-07-20T04:29:11Z

Andrew Morton wrote:
> On Thu, 19 Jul 2007 08:51:49 -0700 Badari Pulavarty <pbadari@us.ibm.com> wrote:
>
>
>>>>+ }
>>>>+
>>>>+ offset += ret;
>>>>+ retval += ret;
>>>>+ len -= ret;
>>>>+ index += offset >> HPAGE_SHIFT;
>>>>+ offset &= ~HPAGE_MASK;
>>>>+
>>>>+ page_cache_release(page);
>>>>+ if (ret == nr && len)
>>>>+ continue;
>>>>+ goto out;
>>>>+ }
>>>>+out:
>>>>+ return retval;
>>>>+}
>>>
>>>This code doesn't have all the ghastly tricks which we deploy to handle
>>>concurrent truncate.
>>
>>Do I need to ? Baaahh!! I don't want to deal with them.
>
>
> Nick, can you think of any serious consequences of a read/truncate race in
> there? I can't..

As it doesn't allow writes, then I _think_ it should be OK. If you
ever did want to add write(2) support, then you would have transient
zeroes problems.

But why not just hold i_mutex around the whole thing just to be safe?

--
SUSE Labs, Novell Inc.