Re: Change in NFS client behavior

From: Andrew Morton
Date: Thu Sep 01 2005 - 23:42:44 EST


Trond Myklebust <trond.myklebust@xxxxxxxxxx> wrote:
>

Looks good from a quick scan.

> +static int do_posix_truncate(struct dentry *dentry, loff_t length)
> +{
> + int err = 0;
> + struct iattr newattrs;
> +
> + newattrs.ia_size = length;
> + newattrs.ia_valid = ATTR_SIZE;
> +
> + down(&dentry->d_inode->i_sem);
> + /* In SuS/Posix lore, truncate to the current file size is a no-op */
> + if (length != i_size_read(dentry->d_inode))
> + err = notify_change(dentry, &newattrs);
> + up(&dentry->d_inode->i_sem);
> + return err;
> +}

I'm not sure that we really need to bother putting the i_size test inside
i_sem. If somebody is changing the file size in parallel with truncate
then they'll get unpredictable results anyway. Needs deep thought.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/