file.c (746f1e558bc52b9693c1a1ecdab60f8392e5ff18) file.c (72b55fffd631a89e5be6fe1b4f2565bc4cd90deb)
1/**
2 * eCryptfs: Linux filesystem encryption layer
3 *
4 * Copyright (C) 1997-2004 Erez Zadok
5 * Copyright (C) 2001-2004 Stony Brook University
6 * Copyright (C) 2004-2007 International Business Machines Corp.
7 * Author(s): Michael A. Halcrow <mhalcrow@us.ibm.com>
8 * Michael C. Thompson <mcthomps@us.ibm.com>

--- 185 unchanged lines hidden (view full) ---

194 mutex_unlock(&crypt_stat->cs_mutex);
195 if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
196 && !(file->f_flags & O_RDONLY)) {
197 rc = -EPERM;
198 printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
199 "file must hence be opened RO\n", __func__);
200 goto out;
201 }
1/**
2 * eCryptfs: Linux filesystem encryption layer
3 *
4 * Copyright (C) 1997-2004 Erez Zadok
5 * Copyright (C) 2001-2004 Stony Brook University
6 * Copyright (C) 2004-2007 International Business Machines Corp.
7 * Author(s): Michael A. Halcrow <mhalcrow@us.ibm.com>
8 * Michael C. Thompson <mcthomps@us.ibm.com>

--- 185 unchanged lines hidden (view full) ---

194 mutex_unlock(&crypt_stat->cs_mutex);
195 if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
196 && !(file->f_flags & O_RDONLY)) {
197 rc = -EPERM;
198 printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
199 "file must hence be opened RO\n", __func__);
200 goto out;
201 }
202 if (!ecryptfs_inode_to_private(inode)->lower_file) {
203 BUG_ON(!(crypt_stat->flags & ECRYPTFS_DELAY_PERSISTENT));
204 mutex_lock(&crypt_stat->cs_mutex);
205 crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
206 mutex_unlock(&crypt_stat->cs_mutex);
207 rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
208 if (rc) {
209 printk(KERN_ERR "%s: Error attempting to initialize "
210 "the persistent file for the dentry with name "
211 "[%s]; rc = [%d]\n", __func__,
212 ecryptfs_dentry->d_name.name, rc);
213 goto out;
214 }
215 }
202 ecryptfs_set_file_lower(
203 file, ecryptfs_inode_to_private(inode)->lower_file);
204 if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
205 ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
206 mutex_lock(&crypt_stat->cs_mutex);
207 crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
208 mutex_unlock(&crypt_stat->cs_mutex);
209 rc = 0;

--- 134 unchanged lines hidden ---
216 ecryptfs_set_file_lower(
217 file, ecryptfs_inode_to_private(inode)->lower_file);
218 if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
219 ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
220 mutex_lock(&crypt_stat->cs_mutex);
221 crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
222 mutex_unlock(&crypt_stat->cs_mutex);
223 rc = 0;

--- 134 unchanged lines hidden ---