Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934784AbdDFPaw (ORCPT ); Thu, 6 Apr 2017 11:30:52 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:35772 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933638AbdDFPan (ORCPT ); Thu, 6 Apr 2017 11:30:43 -0400 Subject: Re: [PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK. To: zhangshuxiaomi@gmail.com, gregkh@linuxfoundation.org References: <1491489029-11052-1-git-send-email-zhangshuxiaomi@gmail.com> Cc: arve@android.com, riandrews@android.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, zhangshuxiao From: Greg Hackmann Message-ID: <94155867-d589-6451-2f3b-a960df559702@google.com> Date: Thu, 6 Apr 2017 08:30:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1491489029-11052-1-git-send-email-zhangshuxiaomi@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1372 Lines: 37 On 04/06/2017 07:30 AM, zhangshuxiaomi@gmail.com wrote: > From: zhangshuxiao > > vfs_llseek will check whether the file mode has > FMODE_LSEEK, no return failure. But ashmem can be > lseek, so add FMODE_LSEEK to ashmem file. > > Signed-off-by: Shuxiao Zhang > Tested-by: Greg Hackmann > --- > drivers/staging/android/ashmem.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c > index 3f11332..e4530ac 100644 > --- a/drivers/staging/android/ashmem.c > +++ b/drivers/staging/android/ashmem.c > @@ -392,6 +392,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) > ret = PTR_ERR(vmfile); > goto out; > } > + vmfile->f_mode |= FMODE_LSEEK; > asma->file = vmfile; > } > get_file(asma->file); > This commit message is missing some important context. ashmem_llseek() passes the llseek() call through to the backing shmem file. 91360b02ab48 ("ashmem: use vfs_llseek()") changed this from directly calling the file's llseek() op into a VFS layer call. This also adds a check for the FMODE_LSEEK bit, so without that bit ashmem_llseek() now always fails with -ESPIPE. I've tested that this patch fixes the regression on both hikey running AOSP and User Mode Linux running Debian.