From Anton Blanchard. This fixes a couple of Linux Test Project
failures.
- Returns EBUSY if the caller is trying to invalidate memory which is
covered by a locked vma.
The open group say:
[EBUSY]
Some or all of the addresses in the range starting
at addr and continuing for len bytes are locked,
and MS_INVALIDATE is specified.
- Returns EINVAL if the caller specified both MS_SYNC and MS_ASYNC
[EINVAL]
The value of flags is invalid.
and:
"Either MS_ASYNC or MS_SYNC is specified, but not both."
int ret = 0;
struct file * file = vma->vm_file;
+ if ((flags & MS_INVALIDATE) && (vma->vm_flags & VM_LOCKED))
+ return -EBUSY;
+
if (file && (vma->vm_flags & VM_SHARED)) {
ret = filemap_sync(vma, start, end-start, flags);
goto out;
if (start & ~PAGE_MASK)
goto out;
+ if ((flags & MS_ASYNC) && (flags & MS_SYNC))
+ goto out;
error = -ENOMEM;
len = (len + ~PAGE_MASK) & PAGE_MASK;
end = start + len;