Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Memory mapping a file on a SMB file share causes it to be transferred in its entirety before the call returns. For large files, this causes the application to lock up for a long period of time. How do I fix this?

"Use X instead of SMB" is a valid answer.

Edit: Any application, any file. I'm not trying to solve a specific case. Memory mapping a file is a way of opening it so that it appears to the application as part of the working memory - you access the file as if it's an array.

share|improve this question

closed as not a real question by mailq, womble, MDMarra, sysadmin1138 Aug 27 '11 at 23:44

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Why not to put the file on a local filesystem? – Alex Aug 27 '11 at 10:08
Which application? Which file? Memory mapped what? Fix what? – mailq Aug 27 '11 at 10:08
So little information. Are you looking for something like this answer? – Steve-o Aug 27 '11 at 16:00
This question is clear, precise, complete, specific and practical and I would hope for a solution. Use NFS instead of SMB is a partial answer as is use a local file system, but these are outside of the control of users of "clusters" or "supercomputers", and I had had problems with NFS too. What application? my research across a cluster of 1000 processors! What file? several terabyte of (streamed/buffered) AV and ontological data! What does it matter? I need a solution that allows simultaneous reading & update of small independent possibly adjacent possibly conjointly blocked parts of the data. – David M W Powers Sep 27 '14 at 14:30
up vote 2 down vote accepted

This is an artifact of the operating system's implementation of mmap, not anything to do with the network protocol in use (as much as I love to rag on SMB...). SMB is more than capable of reading random chunks out of a file, therefore there's no reason it couldn't read chunks as they're requested. I don't have an SMB server accessable at this moment to verify it, but I do have an NFS server, and I just tried to mmap a 1.7GB file and it returned instantaneously, so at the very least it certainly isn't some inherent limitation in the concept of mmap.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.